Open rffontenelle opened 6 months ago
Searching around, this seems to be a setting in a Apache Web Server configuration file httpd.conf
:
<FilesMatch ".+\.php.(pt_BR|zh_CN|other_languages)$">
SetHandler application/x-httpd-php
</FilesMatch>
where (pt_BR|zh_CN|other_languages)
contains all valid languages. Alternatively, add all languages, one per \
@mquinson Can you please check my suggestion?
Quack,
Indeed there is a problem affecting all composite locales. We use Apache mod negotiation to redirect to the proper locale based on the browser/system choices and that works well. It fails because po4a uses an underscore to separate the sublocale, as is usual, whereas Apache for some reason uses a dash.
We are using an updated config because some locales where missing in /usr/share/doc/httpd-2.4.6/httpd-languages.conf
and we can either duplicate the config with underscore instead of dashes for all composite locales or change the website builder to accommodate and change the file name. @mquinson tell me what you prefer.
Regards. \_o<
Considering this explanation, I wonder why does Norwegian (nb_NO) work without issue.
@rffontenelle I think it works because nb_NO
is not in the configuration and it falls back to nb
.
My personal preference is to whatever solution that is easier to apply. If we should just do some git mv
to use the right names, then that's very good. If it's to update the conf file, then so be it.
@duck-rh tell me what's easier for you.
I think it would be easier to rename the files and adapt to what Apache, and the browser, are expecting. That means modifying 01-build-pages.sh
and maybe other things.
The Apache configuration we're using can be seen at https://gitlab.com/osci/community-cage-infra-ansible/-/blob/master/data/tenants/po4a/web/mime.conf?ref_type=heads It comes from the version in Debian because the version in CentOS was outdated, but it's still not perfect, read below.
I realized that some mapping are missing, like zh-Hans and zh-Hant, and I'm going to add them.
As for sr-Cyrl
it seems it should be called sr-Cyrl-RS
instead (to be added in the Apache config and to be fixed in the build script).
Moreover file suffixes do not necessarily match the language tag: pl
is given the .po
file suffix to avoid clashing with Perl scripts but there are others. It looks like a real mess and I would be tempted to change the config to make them always match.
For the webserver config I prepared these changes: https://gitlab.com/osci/community-cage-infra-ansible/-/merge_requests/681 Could you please have a look and tell me how that looks to all of you? Then if it's OK I'll apply it to the server. There's still need to update the website build script but I've never touched it, could you take take of this part @mquinson ?
I wonder if something should be changed on Weblate's side so it still can recognize the message catalog of each language.
I don't know how weblate works but maybe there's a settings to make it follow RFC 3066 (or the obsoleted 1766).
Accessing their translations will download the PHP file corresponding to the browsed page (index, documentation, etc.), instead of browsing them.
This happens for Brazilian Portuguese (português (Brasil)) and Simplified Chinese (简体中文).