New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for locale in the Alpine Images #350
Comments
Sorry for the delay in my answer. I use es_ES myself and I don't recall any trouble with locales, but I will check it before next release. But at first glance... my question would be, why changing the system l18n instead of doing the change at php level? So, did you try changing the date format in OJS with the propper config.inc.php variables? |
Very nice project @marcbria, using Ansible playbooks would be a great advance. Thanks for your reply, I agree with "keep the OS in english and let your app be regional". Maybe all the configuration I made is not necessary nor is the solution, but I was trying to make smarty translation (
Yes, if that is:
I guess the default was
Could you check if the months in the search page are in Spanish? I guess that is the unique misbehaviour a common user may see. If that is not ok we do have a problem, and I would be glad to help (if under my capabilities). If that is ok, I would close this issue and pull out my hair. |
@marcbria I just saw your URL checker, nice work! However, I see in your Testdrive journal search page that the issue with month language persists. You may select any language and months are still in English. |
Wired... In my dockerized OJS (3.3.0-14) they ARE fine: Those are the most relevant variables in my config.ini.php:
Cheers, |
Thanks @marcbria ! I tried with In any case, seems the problem is in my side now 😞 |
Please, keep us informed about your advances. |
Short story
I am facing issues with locale configuration using the
pkpofficial/ojs:stable-3_4_0
image.More specific, the issues are about date and time translations. (In my case, to
pt_BR
)The code that belongs to PKP works nice, however, smarty translations which relies on PHP
strftime
not (although deprecated).It seems that some stuff are misconfigured, I managed to configure until seeing in terminal a positive feedback like:
However, the smarty part still doesn't work. We can check it easily by going to the search page to see the month options or in the admin/systemInfo.
A workaround I managed to see working was to put in the beginning of the template files
{{setlocale(LC_ALL, 'pt_BR.UTF-8')}}
Long explanation
From a time ago the Alpine docker images comes without
icu-data-full
which needs to be installed manually, see:icu-data-full
This didn't helped me so much, so I did my homework and found it:
https://stackoverflow.com/questions/49042223/how-to-set-locale-in-docker-alpine
So, I put all this in my image built on top of the
pkpofficial/ojs:stable-3_4_0
image and still nothing.Then I had 2 goals:
date
put the time inpt_BR
First line from
$intldate->format(time());
was good butstrftime("%A, %B de %G");
was always in english no matter what I put inside thesetlocale
. It was running even with random wrong locale likesetlocale(LC_ALL, "jkasghdjkahgsdjk")
.Okay, in the end I achieved the correct configuration after finding this:
https://www.nixcraft.com/t/how-to-change-date-command-output-language-locales-in-alpine-linux/4434/2
Was missing only the
export MUSL_LOCPATH=/usr/share/i18n/locales/musl
However, after all this work the SMARTY date translation is still NOT WORKING!!!
My Dockerfile with locale configuration:
Sorry bothering, I am new to PHP but I expected to have these images ready to run for different locale and I wish I had arrived with a solution.
The text was updated successfully, but these errors were encountered: