In a project of our company we use gettext to translate text. This has been working for several years, but now I am trying to run the project in Homestead, everything works fine except gettext. When use for example gettext('input_string')
it returns input_string
. On our server and in MAMP everything is working fine. What could be the problem? I am running the project on Apache and PHP 7.0 (same as the server and MAMP)
The domain for locales is binded like this:
bindtextdomain('projectname', APPLICATION_PATH. DIRECTORY_SEPARATOR . 'locale');
textdomain('projectname');
bind_textdomain_codeset('projectname', 'UTF-8');
The path in the bindtextdomain is correct. The file structure is:
- locale
- en_US
- LC_MESSAGES
- projectname.mo
- projectname.po
- fr_FR
- LC_MESSAGES
- projectname.mo
- projectname.po
- nl_NL
- LC_MESSAGES
- projectname.mo
- projectname.po
- pt_PT
- LC_MESSAGES
- projectname.mo
- projectname.po
The locale wasn't installed on Homestead. Fixed it by using sudo locale-gen nl_NL