mayukojpn / force-update-translations

Download WordPress theme/plugin translations and apply them to your site manually even their language pack haven't been released or reviewed on translate.wordpress.org
https://wordpress.org/plugins/force-update-translations/
12 stars 6 forks source link

Glotpress locale is different from WordPress locale #4

Closed Dartui closed 6 years ago

Dartui commented 6 years ago

Hi, let's take Gutenberg plugin and Polish locale as an example.

If we change $locale variable in plugin to pl, we will have this URL to download translation:

https://translate.wordpress.org/projects/wp-plugins/gutenberg/dev/pl/default/export-translations?filters[status]=current_or_waiting_or_fuzzy&format=mo

This is totally correct, but will store it into gutenberg-pl.mo file. WordPress will not recognize it, because for Polish language the locale slug is pl_PL.

There are also another languages, which has two "segments" in locale. On GlotPress there are separated with dash, but WordPress requires underscore as separator (en-gb vs en_GB)

mayukojpn commented 6 years ago

Hi! @Dartui Thank you for reporting! And I'm sorry for forgetting about locale switcher!

I wrote a code for switching locale by user setting, and will dig more into pairing of different WordPress locale codes.

mayukojpn commented 6 years ago

@Dartui It looks this ☝️ change also fixed 2 type locale code problem as well. I'll update a plugin on wordpress.org shortly, so please test it on your site :)

mayukojpn commented 6 years ago

Oops now I understand the problem, wait a moment!

mayukojpn commented 6 years ago

@Dartui It works now :) Can you test on your site? Thanks!

Dartui commented 6 years ago

@mayukojpn everything works great, thanks a lot!