How to get day names in my language

Hi,
I'd like to display the dates in format %A, %d.%m.%Y so that the day names would be in my language (Estonian; Pühapäev instead of Sunday, esmaspäev instead of Monday etc). I also read some threads about language issues here. I tested my host server also with list_locales.php and additionally checked the gettext function and how the day name is displayed by this file. Results:

Http Accept Languages:
Key 1.0-et
code et
coef 1.0
morecode
fullcode et

Supported locales:

And gettext + day name:
Gettext: Yes
Sunday

Is there any way to give my language at least to the day name in frontend? As I understand, there are no supported locales at all although Http Accept Language is Estonian. And gettext is available.

Comments

  • You will have to set up a locale for Estonian. Date formatting is all done via PHP based on the current locale. It could be simply the folder name "EE" in the locale folder.
  • "It could be simply the folder name "EE" in the locale folder."

    Just an empty folder? It didn't help. Only change I see is the error message above the option "Estonian" in admin side where I can choose preferred languages:

    Warning: file_get_contents(/.../zp-core/locale/EE/LC_MESSAGES/zenphoto.po) [function.file-get-contents]: failed to open stream: No such file or directory in /.../zp-core/admin-options.php on line 625

    As I mentioned, the server told me that the only "Http Accept Language" is Estonian (et) and there is no supported locales!

    Maybe the empty folder should be et_EE (and line 58 in functions-i18n.php as well)? And I should choose the Http accept language?
  • Tried. Nothing happened. I even disabled all other languages but Estonian. Still "Sunday", "Monday", "Wednesday" etc. Disabled Estonian too, only Http accept language remained as preferred one. Nothing.
  • acrylian Administrator, Developer
    So does your server support the Estonian locale or not? If not, you won't get the names in Estonian. Aks your host to install it (strange if it is not if you are in Estonia).

    For mimicing et_EE locale files (=translation files which do not cover the months names!) is not possible with an empty folder. Our script of course expects actual translation files to be there, thus the warning.

    The only idea I have would be to create empty translations files to mimic them being there. Please see the translation tutorial for that. You can't duplicate and rename any of the existing ones as then you would of course get those translations.
  • The folder name will need to be the same as whatever your HTTP accept language presents. The list we obtained shows "EE" for Estonian, but of course that may not be correct. The list is in functions_I18n.php, so you may need also to change it there.
  • Thanks. No success. But will the actual translation files help me without the language support (I don't remember exactly but I read somewhere about this issue)?
    For example Joomla translation files are working well in my host server despite there is no et-EE support.
  • Sorry, just one thing succeeded thanks to the fake po and mo you suggested. No error message anymore :)
  • Just for clarification:

    Zenphoto does two things in dealing with local languages.

    First, it uses gettext() calls for all text so that localization can be made from the .mo & .po files are required for this stage. But incomplete (empty?) files can work to an extent. Of course, only text strings for which there are translations will display in the local language. Others will display in English.

    Second, Zenphoto sets the "locale" via a setLocale() function call to tell PHP and the Server what language (locale) is to be used. Certain strings, particularly the Date strings are produced by the PHP runtime and are based on this locale setting.

    Setting the locale can fail if the server does not support the desired locale. If you select the language from the back-end you should see an error message about the failure. The automatic setting of locale, such as from the HTTP Accept Language of the browser may happen in places where the error message display does not go to the browser.

    If the locale setting fails, the language will not be available. There is a define at the beginning of functions-i18n.php for `DEBUG_LOCALE`. Setting this to the value `true` will produce debug log records which may help in diagnosing locale issues.
Sign In or Register to comment.