JavaScript and locales with more than 2 letters are broken in Apache
The suggested Apache config in these docs (See "Apache2 Config" virtualizes the LANG/
directories. It currently does so by looking for top level directories with two letters:
# virtualize the language sub"directories"
AliasMatch ^(?:/\w\w/)?(.*)?$ /var/www/fdroid/$1
# Tell mod_negotiation which language to prefer
SetEnvIf Request_URI ^(?:/(\w\w)/) prefer-language=$1
This breaks for:
- The
js/
directory.- One fix would be to rename this to
javascript/
, although that may need to be changed injekyll-fdroid
also.
- One fix would be to rename this to
- Languages such as
zh_Hans
,es_AR
, orast
.- Could change the regex from
/\w\w/
to\w\w\w?(?:_\w\w(?:\w\w))?
, which matches:- Two word characters (e.g.
en
orfr
) - Three word characters (e.g.
ast
) - Both of the above, optionally suffixed with an underscore then two or four word characters (e.g.
es_AR
orzh_Hans
)
- Two word characters (e.g.
- Could change the regex from
Not sure exactly how frail this is in terms of false positives (like the js/
directory is currently).
The Apache folks have the benefit of hard coding the list of languages into their Apache config, which prevents false positives. We can't do this because the relevant directives cannot go in a .htaccess
file.
I have a feeling that is a bit more difficult for us, because so far our deployment process has revolved as much as possible around "generate a static dir, rsync it to that location". This is notably lacking from our process, and it would be nice if we could get away without having to modify the Apache server configuration.