WordPress.org

Ready to get started?Download WordPress

Forums

Polylang
[resolved] localization problem with .mo file. (6 posts)

  1. Peter_L
    Member
    Posted 7 months ago #

    Hello,

    I'm having a problem with localization.

    A website of mine is available in 4 languages: nl (default), fr, en and es. Everything works fine except for the localization in English. It's doesn't translate the localized string in English (en_US.mo) but instead uses the default Dutch. The other languages' .mo files work just fine.

    To create the theme's .po and .mo files I used Codestyling Localization plugin. I pulled the en_US.mo file from the server and tried it on another server and it worked just fine. Same for the entire theme. So, I'm thinking the problem must be elsewhere.

    Other things I tried are: deleting and recreating the english .po and .mo files, removing the Codestyling Localization plugin and the theme language folder, reinstalling the plugin and recreating.

    I'm at a loss. Currently, I'm thinking a the client might have done something wrong while creating the language (through polylang) and that is causing the problem. How could I verify this?

    Do you have any other ideas what might be causing this?

    http://wordpress.org/plugins/polylang/

  2. Chouby
    Member
    Plugin Author

    Posted 7 months ago #

    Why do you need an en_US.mo file?

  3. Peter_L
    Member
    Posted 7 months ago #

    Because my theme template files contain some text strings that need translation and the default language is Dutch, not English.
    __('Dutch text', 'theme name')

  4. Chouby
    Member
    Plugin Author

    Posted 7 months ago #

    That's probably the source of your issue. By default, WordPress supposes that everything is written in 'en_US' and it loads translations for other languages.

    In Polylang languages, could you try to change the English locale to 'en_GB' instead of 'en_US' and rename your theme localization file from 'en_US.mo' to 'en_GB.mo'?

  5. Peter_L
    Member
    Posted 7 months ago #

    Yes, this solved it.

    In polylang, I changed locale to en_GB.

    Then I deleted the en_US.mo from my theme language folder and renamed the en_US.po to en_GB.po. Then I opened my codestyling localization plugin and created the en_GB.mo file. (little detour to keep edibility in the codestyling plugin on the english theme language file).

    Thank you very much! Really appreciate your help.

    As for,

    That's probably the source of your issue. By default, WordPress supposes that everything is written in 'en_US' and it loads translations for other languages.

    I'm not sure because I usually use a Dutch install of WordPress, so that should've had the default on nl_NL.
    http://nl.wordpress.org/
    But I could've 'accidently' used the US version as well. Can't remember.

  6. Chouby
    Member
    Plugin Author

    Posted 7 months ago #

    You are right. I checked and Polylang assumes in one place that the default locale is en_US. That's may be the source of your issue. I made that to save some time but I may have to reconsider this.

Reply

You must log in to post.

About this Plugin

About this Topic