Jump to content
Sign in to follow this  
andulka

Translating theme spesific phrases

Recommended Posts

andulka

I'm using qtranslate language switcher to translate the site into Finnish, which is working fine except the theme specific phrases don't get translated (such as 'go to top', 'nn responses' and also, for some reason, 'comments'). Part of the theme text I've been able to translate directly in the php files, but not everything (like the phrases mentioned above). I'd like to be able to translate those as well, and have used Poedit to translate the Station_po file. However I'm not able to get the translation to work. Here's what I've tried so far (all together and in different combinations): Named the translated files fi_FI.po and ...mo, uploaded them into the theme folder, added

<?php load_theme_textdomain('TDOMAIN'); ?>

to functions.php, added define ('WPLANG', 'fi'); in the config.php, but no luck. I've never done this before, so any pointers as to what I'm doing wrong would be appreciated. Alternatively, any advise on how and if those could be translated directly in the php files. Would be nice to have especially the 'comments' and 'responses' translated, as it looks a bit silly with everything else in Finnish... The site in question is here, in case that has any relevance. Theme is StationPro.

Share this post


Link to post
Share on other sites
Andrew

Hmm... Did you regenerate a translation file when you started? I checked the theme; and these strings were localized and didn't have any syntax errors that I saw...

Share this post


Link to post
Share on other sites
bryan-hadaway

"Go To Top" - Where to find: Appearance > Editor > _contentfooter.php "Responses" / "Comments" - Where to find: Appearance > Editor > _post_footer.php Thanks, Bryan

Share this post


Link to post
Share on other sites
andulka

Bryan, I'm able to locate those files but don't get the translations to work for those particular ones, no idea why (except that I', obviously doing something wrong as it's pretty much guessqwork from my part. It's just so annoying as it's only a couple of simple phrases that still would need to be fixed... I've used simple language tags for some of the translations in the php files, probably a highly incorrect way to do it but it works, just not with these particular terms. Andrew, I did that too, and noticed the generated file was slightly different from the original station.po file - for example

One Response to %2$s

is missing there, and neither one has the plural form of the same.

Share this post


Link to post
Share on other sites
bryan-hadaway

Oh, I see... I thought you merely needed to change them to Finnish, but you need to switch back and forth. Well, it is good that we pinpointed them. I think now we would need to put conditional tags on them so that it knows what to show depending on the language selected. I think you might need developer help for such a task or perhaps there is a better all around solution. Be sure to bump your topic so they can see you. Thanks, Bryan

Share this post


Link to post
Share on other sites
andulka

Yes, switching the language would be necessary, and the qtranslate does a pretty good job of it, apart from those few terms that are an issue here. Some developer help would really be appreaciated if that's the way to do it, and just translating the theme's po file and doing the rest as I've described doesn't get the job done.

Share this post


Link to post
Share on other sites
Andrew

Jaana, Are the strings you're talking about in the file you translated?

Share this post


Link to post
Share on other sites
andulka

Andrew, 'Go to top' is there, also 'Comments' and 'One Response to %2$s' are in the original Station.po file, but the file i regenerated is missing at least the last one, both are missing the plural 'responses' (as would be used in 'nn responses to').

Share this post


Link to post
Share on other sites
bryan-hadaway

Bump again later tonight (the latest you're on) for the developers to see you in the morning. Don't want to bury your topic :). Thanks, Bryan

Share this post


Link to post
Share on other sites
andulka

Haven't had time to come round and bump this, but I'm still looking for a solution! :-)

Share this post


Link to post
Share on other sites
cmunns

So the information is being lost once you regenerate the file? Are there settings when you do this where you decide what functions get translated? e.g. __ vs. _e or _n

Share this post


Link to post
Share on other sites
andulka

Yes, some of it is lost, but not everything, and the problem is that nothing is translated as far as I can see. The parts of the theme that are translated at the moment have been translated manually in the php files, probably completely wrong but as long as it works... :-) As far as I can remember, I used __, _e and something else but not quite sure anymore and don't have time to check it now - and like I said, the problem is that nothing is translated so it's probably something else I'm doing wrong.

Share this post


Link to post
Share on other sites
cmunns

Did you look up resources on how to properly generate a .po/.mo file? There are many others besides __, _e, _n, and even expressions like gettext Also, did you use a plugin to generate the file or did you do it manually. A plugin might have that stuff built-in

Share this post


Link to post
Share on other sites
andulka

No, I didn't use other ones it seems, as those were the ones I was able to find on the Wordpress Codex instructions page (which only has __ and _e) and a couple of other places I checked. Any ideas where I should look for additional ones? I used poedit to generate the files.

Share this post


Link to post
Share on other sites
cmunns

Well definitely regenerate the file and add _n as that will translate functions that have multiple scenarios e.g. comment count for zero, one, and multiple.

Share this post


Link to post
Share on other sites
cmunns

Jaana, Did you end up resolving this issue? I'm curious as it would help future users

Share this post


Link to post
Share on other sites
andulka

Hi, afraid not (sorry for the long silence, I've been away). I'm still not able to generate a file that would include phrases like 'One Response to %2$s', 'responses' etc. I used __, gettext, gettext_noop, _n, _vs, _e to generate the file. Also, the original main problem still remains, which is that nothing is translated when I add the fi_FI files into the languages folder, not even the phrases that are there. So even if I eventually manage to generate a file with all the phrases, how do I get the theme to use the translated file...?

Share this post


Link to post
Share on other sites
cmunns

I'll try going through the process today to see if I can troubleshoot it.

Share this post


Link to post
Share on other sites
andulka

That would be great, thanks! I'm beginning to think the problem with nothing being translated may have something to do with the zTranslate language switcher plugin. I tested changing the NextGen Gallery language and it doesn't work either (I tested with the included German file before going into the trouble of translating the language file). It would be nice to have the 'show as slideshow' and 'photos' translated, but they remained in English after switching the language into German (after first having enabled it on zTranslate). The locale it uses should be the standard fi_FI, and it works with some other plugins, so I can't imagine where the problem could be... At the moment I'm more or less stuck with zTranslate as some band members are used to using it on their previous record company sites and I haven't been able to find an alternative that would work more or less in the same way.

Share this post


Link to post
Share on other sites
bryan-hadaway

Forwarding to developers just to make sure it stays fresh. Thanks, Bryan

Share this post


Link to post
Share on other sites
cmunns

hmm if it's not translating at all it must be the plugin, bc I can't even find it to test it out and I know other users have had success with the likes of WPML plugin and qtranslate

Share this post


Link to post
Share on other sites
cmunns

but then again i just saw the first post in this thread seeing that qtranslate didn't do the complete job, okay i'll test with qtranslate.

Share this post


Link to post
Share on other sites
cmunns

So with qtranslate did you actually go in and translate strings to create a .mo file? I was testing qtranslate and used codestyling localization plugin to translate

Share this post


Link to post
Share on other sites
andulka

Sorry, I got the names mixed up, it's qtranslate I was talking about. I generated the files using poedit, the functions used are discussed in the earlier posts. One of the guys in the band has another wordpress site here, also using qtranslate but a different theme, and everything works there. The site is for time being formally run by Sony, the record label, and I only have basic admins there so I can't really see what's been done (and without going into details I'm not likely to find out anything more from them either). And it's a different theme anyway.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×