10380 Posts in 2195 Topics by 1711 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1016 Views |
-
Customtranslations not adding custom translation

22 June 2010 at 4:35am Last edited: 22 June 2010 5:13am
Hi,
I've just installed Customtranslations and I was trying to add a custom translation using the 'Create Custom Language Translation'-button but when I click the 'Add'-button, nothing happens.
Although clicking the plus-sign near an already existing translation, editing the values to match the same values entered when I clicked the 'Create Custom Language Translation'-button, and then clicking the 'Add'-button works. Is this suppost to work this way or is the 'Create Custom Language Translation'-function just broken?
Cheers!
-
Re: Customtranslations not adding custom translation

22 June 2010 at 5:24am Last edited: 22 June 2010 5:24am
Okay I've found the problem and I fixed it.
The problem occurs in the CustomTranslationValidator class where it checks for 'OriginalTranslation'. But that value doesn't exist when creating clicking the 'Create Custom Language Translation'-button.
Since the whole function depends on that value it will never return true nor will it display.Here's the edited method:
function php($data) {
// Set value to true unless set otherwise below
$valid = true;if (!parent::php($data)) return false; // required fields failed.
// do we have a OriginalTranslatio value? If not, why continue validating? ;)
if (isset($data['OriginalTranslation'])) {
$origTokens = $this->getTokens($data['OriginalTranslation']);
$newTokens = $this->getTokens($data['Translation']);// determine if they are the same
$valid = count($origTokens) == count($newTokens);if ($valid && count($origTokens) > 0) {
// Counts are the same, so iterate over both arrays and ensure they are compatible.
for ($i = 0; $i < count($origTokens); $i++) {
// @todo This requires an exact match. For example, %10d and %d won't match, but should.
if ($origTokens[$i] != $newTokens[$i]) $valid = false;
}
}
}if (!$valid) {
$this->validationError(
'Translation',
_t('Form.FIELDSIGNATUREMISMATCH', "The value substitution tokens in the new translation must match the tokens in the original translation string"),
"invalid"
);
}return $valid;
} -
Re: Customtranslations not adding custom translation

25 June 2010 at 8:31pm
Hi. Thanks for that. I will have a look at integrating that back in
Mark
-
Re: Customtranslations not adding custom translation

26 June 2010 at 4:56am
No worries, glad i could help
| 1016 Views | ||
|
Page:
1
|
Go to Top |


