Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localization #567

Closed
vyskoczilova opened this issue Apr 22, 2016 · 4 comments
Closed

Localization #567

vyskoczilova opened this issue Apr 22, 2016 · 4 comments

Comments

@vyskoczilova
Copy link
Contributor

Hi,

I have translated the plugin into Czech (I will make a pull request when checked the correctness), but I'm not able to load the translation... Could you help me please? It works, but only in English.

It's a custom theme with translation slug "customtheme".

in my function.php I'm calling those files:

require_once( dirname( __FILE__ ) . '/core/class-tgm-plugin-activation.php' );
require_once( dirname( __FILE__ ) . '/core/register-plugins.php' );

I have tried to place the translation both to:

  • customtheme/langugages
  • customtheme/core/langugages

and trying to rename it:

  • cs_CZ.mo
  • tgmpa-cs_CZ.mo
  • cs_CZ.po
  • tgmpa-cs_CZ.po

I have added define('WPLANG', 'cs_CZ'); into wp-config.php.

@vyskoczilova vyskoczilova changed the title Localziation Localization Apr 22, 2016
@vyskoczilova
Copy link
Contributor Author

vyskoczilova commented Apr 22, 2016

I found it out, needed to load as well tgmpa text domain:
load_theme_textdomain( 'tgmpa', get_template_directory() . '/languages' );

and the correct address for the translation files is: customtheme/langugages/cs_CZ.mo and customtheme/langugages/cs_CZ.po

But is there any way around to keep langugage fiels separate from my theme one? Thanks a lot.

@jrfnl
Copy link
Contributor

jrfnl commented Apr 22, 2016

Hi @vyskoczilova, thanks for making the translation! It would be great if you could send in a pull request for that!

And yes, the translation needs to be loaded. We didn't do this in v2.5.2 as there were no translations yet.
However, in the code in the develop branch we already do this, so if you test with the class-tgm-plugin-activation.php from the develop branch and place your files in the tgmpa/languages folder with the prefix tgmpa- (so the files look like tgmpa-cs_CZ.po/mo) it should work out of the box. This will also keep the TGMPA translations separate from your theme ones.
(in your case, I guess the folder would be customtheme/core/languages as you have the TGMPA file in the core folder)

We're getting ready to release v2.6.0 in a little while. In preparation to that, I've updated the tgmpa/languages/tgmpa.pot file with the latest strings and have an open pull request for the localization.

If you could update your .po/mo files based on the tgmpa.pot file found in that pull request and could send in a PR against the feature/additional-translations branch, that would be great!

As a side-note: please note that if you host your theme on wp.org, they are not so happy with us keeping the translations separate from the theme and if people download TGMPA via the Custom Generator the bit of code which loads 'our' translations will be taken out again. If you host your theme elsewhere, it should be fine.
All the same, for themes hosted on wp.org translations are pulled in from translate.wordpress.org anyway and for a lot of languages most TGMPA strings are already translated there, so it shouldn't be too much of an issue.

@vyskoczilova
Copy link
Contributor Author

Hi @jrfnl thanks for this answer (maybe you could add it somewhere in the readme?), I tried to pulled a request, hopefully I did it.
Good luck, it's really a great plugin.

@jrfnl
Copy link
Contributor

jrfnl commented May 2, 2016

@vyskoczilova Thanks Karolína! Your support is much appreciated.

I kind of hope that once v2.6.0 is released, we won't receive more questions about the localization, so I haven't added an FAQ, though the information will be in the changelog. If we still get questions about this after the 2.6.0 release, I'll add the FAQ ;-)

@jrfnl jrfnl closed this as completed May 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants