Skip to content

Translation not being picked up on Ubuntu

edited April 2013 in Troubleshooting

Hi,
I've managed to get translations working on my development machine by following the recommended steps, but I can't get them to work in production. I've already checked file permissions, cleaned apc cache, reloaded php-fpm and nginx. I've also checked the production database and my login is already set up for the second language. gettext is working fine at this server, which can be confirmed by a wp install with localization. Any ideas?

Comments

  • Hi angelim,

    I see you're using Ubuntu. For gettext to pick up your language on Ubuntu, you need to add proper locales to your system first → http://pof.eslack.org/2010/11/17/php-gettext-problems-on-ubuntu-server/

    This was written in Step 4 of Sendy's translation guide but I guess you've missed it.

    Thanks.

    Ben

  • Hi Ben,
    Thanks for the quick response. While it didn't solve the issue right away, it led me in the right direction.

    The language I was trying to set up was pt_BR, which was already being used on a Wordpress installation in this server(to my knowledge it also uses gettext for translation).

    # dpkg-reconfigure locales Generating locales... en_US.UTF-8... up-to-date pt_BR.UTF-8... up-to-date

    The only difference on the localization support files is that I don't have a file for each language. I have only one file listing all of them.

      # cat /var/lib/locales/supported.d/local
      en_US.UTF-8 UTF-8
      pt_BR.UTF-8 UTF-8 
    

    I was generating my .mo files for the default character set(using the directory /pt_BR/) and locales had only the pt_BR.UTF-8 version. When I changed the line to "pt_BR UTF-8" and regenerated locales, all worked well.

    http://stackoverflow.com/questions/5257519/cant-get-gettext-php-on-ubuntu-working

    Because you're forcing encoding to UTF-8 T_bind_textdomain_codeset('default', 'UTF-8');, I think I'll be fine.

    Best regards

    Alexandre

  • Hi Alexandre,

    Thanks for sharing.

    Ben

This discussion has been closed.