ZenphotoCMS Forum
Translations not working for non-Zenpage elements - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: Translating (https://forum.zenphoto.org/forum-8.html)
+--- Thread: Translations not working for non-Zenpage elements (/thread-7563.html)



Translations not working for non-Zenpage elements - Guest - 02-09-2010

The user and all related content has been deleted.




Translations not working for non-Zenpage elements - kagutsuchi - 02-09-2010

This sounds like an error with page caching; do you have the static_html_cache plugin enabled? I'm not sure that it could cause this problem, but other than that, I'm not really sure.




Translations not working for non-Zenpage elements - acrylian - 02-09-2010

Important for gettext strings is the line in what file they have been found. Sometimes it even works quite clever with terms that moved in a line or same terms appearing elsewhere but not always (don't ask me). This is mostly the case with custom themes or plugins. Instead of editing the po file you should reparse the whole installation including your theme.

I can't reproduce the contact form issue with the contact form in the code block 1 in the Zenpage theme. So this must be related to your theme as well.

We have the capability to generate a special translation for just a theme but that currently conflicts with the main zp translation for technical reasons. That is on our list though.




Translations not working for non-Zenpage elements - sbillard - 02-09-2010

Are you saying that this happens only when the "extra" locale folders are deleted?




Translations not working for non-Zenpage elements - acrylian - 02-09-2010

Now that would be interessting as English is the default...




Translations not working for non-Zenpage elements - Guest - 02-09-2010

The user and all related content has been deleted.




Translations not working for non-Zenpage elements - midas - 03-09-2010

Hi
I found bug
My previous ZP is 1.3
after upgrade to nightbuild 1.31 I got the same error.
This error exists only for localhost windows but linux is ok.
Now look (change function to the previous version 1.3 and now work!!)

function setupCurrentLocale($override=NULL, $plugindomain='', $type='') {
if(empty($plugindomain) && empty($type)) {
if (is_null($override)) {
$locale = getOption("locale");
} else {
$locale = $override;
}
// gettext setup // 1.31
/
$result = i18nSetLocale($locale);
if ($result) {
@putenv('LANG='.$result);
@putenv('LANGUAGE='.$result);
} else {// failed to set the locale
if (isset($_REQUEST['locale']) || is_null($override)) { // and it was chosen via locale
if (isset($_REQUEST['oldlocale'])) {
$locale = sanitize($_REQUEST['oldlocale'], 3);
setOption('locale', $locale, false);
zp_setCookie('dynamic_locale', '', time()-368000);
}
}
}
/
@putenv("LANG=$locale"); // 1.3
// gettext setup
$result = setlocale(LC_ALL, $locale.'.'.$encoding, $locale, NULL);
if (!$result) { // failed to set the locale
if (isset($_REQUEST['locale']) || is_null($override)) { // and it was chosen via locale
if (isset($_REQUEST['oldlocale'])) {
$locale = sanitize($_REQUEST['oldlocale'], 3);
setOption('locale', $locale, false);
zp_setCookie('dynamic_locale', '', time()-368000);
}
}
}
// Set the text domain as 'messages'
$domain = 'zenphoto';
$domainpath = SERVERPATH . "/" . ZENFOLDER . "/locale/";
if (DEBUG_LOCALE) debugLogBacktrace("setupCurrentLocale($override, $plugindomain, $type): locale=$locale, \$result=$result");
} else {
$domain = $plugindomain;
switch ($type) {
case "plugin":
$domainpath = getPlugin($domain . "/locale/");
break;
case "theme":
$domainpath = SERVERPATH . "/" . THEMEFOLDER . "/" . $domain."/locale/";
break;
case 'admin':
$domainpath = getPlugin($domain . "/locale/");
$domain = 'zenphoto';
break;
}
$result = true;
if (DEBUG_LOCALE) debugLogBacktrace("setupCurrentLocale($override, $plugindomain, $type): domainpath=$domainpath");
}
bindtextdomain($domain, $domainpath);
// function only since php 4.2.0
if(function_exists('bind_textdomain_codeset')) {
bind_textdomain_codeset($domain, 'UTF-8'); // 1.31
//bind_textdomain_codeset($domain, $encoding); // 1.3
}
textdomain($domain);
return $result;
}




Translations not working for non-Zenpage elements - kagutsuchi - 03-09-2010

Well, seems that it wasn't as simple as I initially thought (that's what I get for trying to reply before running out the door!).

Anyway, I see that there was a changeset that might fix this problem. It should be included in the next nightly build. http://www.zenphoto.org/trac/changeset/5830




Translations not working for non-Zenpage elements - midas - 04-09-2010

Hi
Nightbuild did not solve the problem for windows (Linux-goddady.com work correctly).

Windows7 64


Zenphoto version 1.3.1.2 [5833] (Official Build)


PHP version: 5.2.9-2


Graphics support: PHP GD library bundled (2.0.34 compatible)


PHP memory limit: 128M (Note: Your server might allocate less!)


MySQL version: 5.1.33




Translations not working for non-Zenpage elements - midas - 04-09-2010

OK I check function again and change (//midas).
Now check on my host linux (goddady) and windows7 and work good

function setupCurrentLocale($override=NULL, $plugindomain='', $type='') {
if(empty($plugindomain) && empty($type)) {
if (is_null($override)) {
$locale = getOption("locale");
} else {
$locale = $override;
}
// gettext setup
@putenv("LANG=$locale");
@putenv("LANGUAGE=$locale");
$result = i18nSetLocale($locale);
//$result = setlocale(LC_ALL, $locale.'.'.$encoding, $locale, NULL);
if ($result) {
//midas @putenv('LANG='.$result);
//midas @putenv('LANGUAGE='.$result);
} else {// failed to set the locale
if (isset($_REQUEST['locale']) || is_null($override)) { // and it was chosen via locale
if (isset($_REQUEST['oldlocale'])) {
$locale = sanitize($_REQUEST['oldlocale'], 3);
setOption('locale', $locale, false);
zp_setCookie('dynamic_locale', '', time()-368000);
}
}
}
// Set the text domain as 'messages'
$domain = 'zenphoto';
$domainpath = SERVERPATH . "/" . ZENFOLDER . "/locale/";
if (DEBUG_LOCALE) debugLogBacktrace("setupCurrentLocale($override, $plugindomain, $type): locale=$locale, \$result=$result");
} else {
$domain = $plugindomain;
switch ($type) {
case "plugin":
$domainpath = getPlugin($domain . "/locale/");
break;
case "theme":
$domainpath = SERVERPATH . "/" . THEMEFOLDER . "/" . $domain."/locale/";
break;
case 'admin':
$domainpath = getPlugin($domain . "/locale/");
$domain = 'zenphoto';
break;
}
$result = true;
if (DEBUG_LOCALE) debugLogBacktrace("setupCurrentLocale($override, $plugindomain, $type): domainpath=$domainpath");
}
bindtextdomain($domain, $domainpath);
// function only since php 4.2.0
if(function_exists('bind_textdomain_codeset')) {
bind_textdomain_codeset($domain, 'UTF-8');
}
textdomain($domain);
return $result;
}




Translations not working for non-Zenpage elements - sbillard - 04-09-2010

Ok, strange that Windows will not deal correctly with the locale result that it returns from setlocale. We will remove those lines as I believe they are relevant to Windows only.

Sorry, but we do not test on Windows servers.




Translations not working for non-Zenpage elements - midas - 05-09-2010

Thanks for the fix.
I'm a programmer Delphi / C + +. PHP has just spoken. I am making a page for myself and I was forced to learn PHP and javascrip / ajax. I think that helped a little. Thank you for your work.

Krzysztof
Poland/USA




Translations not working for non-Zenpage elements - sbillard - 05-09-2010

You don't meet too many Delphi programmers. If I had my way that would be the only language I used. This C and C derivitive stuff is just too conducive of making errors.

Good luck with the PHP/Javascript. Should not take you too long to get them under your belt. Zenphoto will provide you with lots of good examples to learn from.