Help, I created a Polish locale for my theme but I cannot get ZP to read it.
I use Zenphoto 1.2 and the Dynamic Locale plugin (I choose "Polish" but not everything is translated).
My theme is called pp
The translation files are called pp.po and pp.mo
www.panopixel.org/zenphoto/themes/pp - my theme
www.panopixel.org/zenphoto/themes/pp/locale/pl_PL/LC_MESSAGES - pp.po and pp.mo files here
www.panopixel.org/zenphoto/zp-core/locale/pl_PL/LC_MESSAGES - zenphoto.po and .mo files here, they do not contain everything I need so I created my own theme translation file.
When I select the Polish language then ZP uses my Polish descriptions and other Polish image data I entered in the admin panel, and it uses some of the gettext() things found in the zp-core/blabla/zenphoto.mo file, but things that are not in that file are left as English in my gallery! I read the translation guide several times and checked my dir names and it all looks fine.
Example of a string that does get translated:
<?=gettext('Name:');?>
It gets it from the main polish translation zenphoto.mo
Example of a string that doesn't:
<?=gettext('Write a comment');?>
This one isnt in zenphoto.mo but it doesn't read my pp.mo
What did I do wrong?
Do I need to add some string to my theme image.php file to make it look for things that are missing from zp-core/blabla/zenphoto.mo in themes/pp/locale/pl_PL/LC_MESSAGES/pp.mo ?
Comments
Please read this section of our translating tutorial: http://www.zenphoto.org/2008/05/translating-tutorial/#theme-translation
Currently undocumented you need then to add `setThemeDomain("pp")` (always the theme folder name) on top of each of your theme files to use the separate translation. Otherwise zp will use the main locale in zp-core and since gettext is depended on line numbers where it finds the strings it will not work then.
Btw, the same is possible with plugins (`setPluginDomain()`).
"you need then to add setThemeDomain("pp") on top of each of your theme files"
You mean in index.php album.php and image.php?
I didn't know that I needed a nightly build, I will try this tomorrow, thank you very much!
You mean in index.php album.php and image.php?
All of them that should use it. So also search.php, archive.php and 404.php, slideshow.php if you modified it. And also don't forget any other custom page you may additionally use. Place that function before anything else (even the webpath define).
I do have one problem though. I use zenPaypal and I cannot get the following words to use my translated versions:
Size, Stock, Matte, Gloss, Canvas, Price List, size, media, price
I created a zenPaypal.po and mo file in:
/zenphoto/zp-core/plugins/zenPaypal/locale/pl_PL/LC_MESSAGES
I also added
<?php setPluginDomain("zenPaypal"); ?>
to the beginning of zenPaypal.php in /zp-core/plugins/zenPaypal.php
Note that those words are translated in two places:
/zenphoto/zp-core/plugins/zenPaypal/locale/pl_PL/LC_MESSAGES
and
/zenphoto/zp-core/locale/pl_PL/LC_MESSAGES
So even if the plugin didn't read its specific translation file, it should find them in the main zenphoto.po
I also tried adding
<?php setPluginDomain("zenPaypal"); ?>
to my theme's image.php but that didnt help.
What do I need to do to fix this?
Fatal error: Cannot break/continue 1 level in /home/drslony/public_html/zenphoto/zp-core/functions-i18n.php on line 286
Nobody else whom I tried my gallery with gets it.
His locale is en-GB, perhaps thats important.
This is the url I sent him:
http://www.panopixel.org/zenphoto/index.php?album=alpha&image=00000436.jpg
ps. I use the nightly build from 2008-09-17 and my zp-core/locale/ dir has only these two:
en_US
pl_PL
I deleted the other ones because I will never use them and they cluttered my "edit image" page in the admin panel. I doubt this has an influence on the error, but I'm mentioning it because you know better.
The items you mentioned are gettexted in around line 38 and should work.
Regarding en_GB. First I discovered that we have the none existing en_UK in our list. but that should actually not do any harm since no separate language files are for that. I am not sure but that the error you reported should actually been fixed.
You did actually everything correctly. I have no real idea now. I visited your site, could you please install the German language, so that I can check if I get any German translations for that? (I assume the dynamic locale plugin is enabled).
PS: I visited your site, you should check the size of the div in the middle, I get an ugly scrollbar in Safari 3.
Acrylian: "PS: I visited your site, you should check the size of the div in the middle, I get an ugly scrollbar in Safari 3."
Yes I found this too even in Firefox, no idea why since before the update of Zenphoto I didn't have this, and I just copied my theme to the new ZP nightly build... perhaps I edited some css file not in my theme dir as well. I will fix this when the translations work properly.
"First, actually the zenpaypal translation is included within the Zenphoto's main translation files since it's an official plugin. The items you mentioned are gettexted in around line 38 and should work."
Hmm, so those translations are in two places:
zenphoto.po
zenPaypal.po
I deleted "<?php setPluginDomain("zenPhoto"); ?>" from zenPhoto.php (reason below).
If I add "<?php setThemeDomain("pp"); ?>" to my image.php then the following get translated:
My custom info text at the bottom of the page and my strings about comments, so all things found in image.php. zenPaypal things do not.
If I delete "<?php setThemeDomain("pp"); ?>" from image.php then the following get translated:
Media, size, material, price.
I obviously need my theme to use several translation files at the same time - pp.po with my own theme polish text translations, the main zenphoto.po with general polish translations, and zenPaypal.po with zenPaypal's "media canvas gloss etc" translations. How do I get my theme to use them at the same time?
Note that I deleted "<?php setPluginDomain("zenPhoto"); ?>" because it didn't add any new translations, and in fact without it the word "Media" got translated, with it it didn't.
Also when I ran zenPaypal.php through Poedit I didnt find the word "Gloss", only "Glossy", but on my page the word "Gloss" is used... where does zenPaypal get its strings form then?
Screenshots:
1- setThemeDomain("pp"); OFF (ie. not there) http://bayimg.com/image/oakocaabi.jpg
2- setThemeDomain("pp"); ON http://bayimg.com/image/oakodaabi.jpg
in both cases setPluginDomain("zenPhoto"); in zenPhoto.php was 'off'
"could you please install the German language, so that I can check if I get any German translations for that?"
done
jlang: how do I find ticket 763? I tried adding 763 to ?id= but that didnt point me to the right ticket.
http://www.zenphoto.org/trac/ticket/763
This is seperate from the support forum software.
I actually don't understand what that is. There is no plugin "zenphoto". This can't work. If you were trying to get the main translation, that is done automatically. Nothings needs to be added manually.
May I ask how you generated the po file for your theme. Just to be sure, you need to set up Poedit to only parse the folder of your theme.
Sorry, I never used this plugin myself, but maybe I have an idea: You probably added you custom price list in the text field in the options, right? These will not be gettexted because they have already been printed. Gettext translations happens before printing. This way they are printed directly as they are stored in the db. To be gettexted you need to change the array directly in the zenPayPal.php plugin file. We probably need to turn the field into a multilanguage field.
You are right, this is my zenPaypal pricelist:
40x30cm:Matte=40 40x30cm:Gloss=40 40x30cm:Canvas=90 60x40cm:Matte=90 60x40cm:Gloss=90 60x40cm:Canvas=160 90x60cm:Matte=180 90x60cm:Gloss=180 90x60cm:Canvas=300
The pp.po file for my theme was made using only my theme files:
/home/drslony/.poedit/pp/album.php
/home/drslony/.poedit/pp/image.php
/home/drslony/.poedit/pp/index.php
/home/drslony/.poedit/pp/theme-functions.php
/home/drslony/.poedit/pp/theme_description.php
I don't have any problems with that pp.po file.
The zenphoto.po file I made using the latest nightly build, I downloaded the outdated incomplete polish translation, i set it to use the zp-core dir and I ran 'update from sources'. Then I made sure that words like "size", "Size", "Stock", "Price List" etc. are all translated.
But the problem with my translation still exists:
Several of the words EXIST in http://www.panopixel.org/zenphoto/zp-core/locale/pl_PL/LC_MESSAGES/zenphoto.po
Zenphoto DOESNT translate them... Why?
I wrote that still things like "size" "stock" "price list" etc are not translated. See this screenshot: http://bayimg.com/image/lakpfaabi.jpg
They ARE gettext if you look at the zenPaypal.php file (e.g. lines 185, 196, 197, 198), and as I wrote, I DID translate them in zenphoto.po.
Because that didn't work, I ALSO made a zenPaypal.po file where I again translated those things and I tried adding <?php setPluginDomain("zenPaypal"); ?> so zenPaypal.php but that didn't help.
How do I get that image.php to use two po files?
I need to use zenphoto.po for the translation of things like "Price List" "media" "stock" etc (all the things marked by lines in the screenshot).
I need to use pp.po for things like that long text at the bottom, and "no comments", "write a comment".
The screenshot with the lines shows the things that are NOT part of the price list. They are normal gettext items in zenPaypal.php
I no longer need help since I solved this myself, but I'm still repeating this so that you can understand the problem and make zenphoto better for others.
So once again, the problem:
My theme has some gettext items like the long paragraph under each image and the names of the items in the comments form, and other things that I created, so they need a pp.po file.
BUT!
My theme also uses many things that need gettext strings that are already translated in zenphoto.po, like zenPaypal which has its own gettext items, namely the following things:
Size, Stock, Price List, size, media, price
so it needs to use the main zenphoto.po file!
So now I had a problem: if I wanted to use a pp.po file for my own gettext calls, then zenphoto ignored the other translations in zenphoto.po!
If at the beginning of image.php I add this:
<?php setThemeDomain("pp"); ?>
then zenphoto doesnt read zenphoto.po, which means that only half of my things are translated!
So I asked several times how can I make my theme use several po files, is that possible?
Well I wasn't getting an answer for half of my questions, so I tried something: since I couldn't get ZenPhoto to read 2 po files, I copied zenPaypal.php to the other theme files in my Poedit dir and then I created all required translations in pp.po
This worked, now I have everything translated!
I don't think this is a good solution, since except for my own text in pp.po everything else I needed was already in zenphoto.po, and my method unnecessarily duplicates it, but unless someone attentively reads what I write and tells me (and others) how to make image.php use 2 (or more) .po files, this is my only solution.
It is not possible to have a theme use two translation files currently. You actually should only need the the main translation file for all included plugins, themes, etc and the one for your theme's special additions via setThemeDomain().
So you may indeed discovered an unoticed conflict
I have made some test and indeed I can reproduce it. I never noticed it with the zenpage theme that uses theme translation as well, probably because I didn't use that much other plugins for it. We will investigate that, but to be honest I have no clue currently.