Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c181a83b48 | ||
|
|
c830a32962 |
@@ -13,6 +13,7 @@ en_US@latin -> en_US -> en
|
||||
|
||||
* en
|
||||
* en_US
|
||||
* en_US.UTF-8
|
||||
* en_US@latin
|
||||
|
||||
### Domain
|
||||
@@ -32,7 +33,9 @@ if not set UTF-8 is assumed. Any other utf8 encoding is changed to UTF-8
|
||||
|
||||
## File name example source
|
||||
|
||||
`ja_US.admin.UTF-8.po`
|
||||
`ja-admin.po`
|
||||
|
||||
First part is LOCALE, second part is domain. Separator is `-`
|
||||
|
||||
## Folder layout
|
||||
|
||||
@@ -49,4 +52,4 @@ frontend: dmain (CONTENT_PATH)
|
||||
|
||||
## command
|
||||
|
||||
`msgfmt -o www/includes/locale/ja_JP/LC_MESSAGES/frontend.UTF-8.mo 4dev/lang/ja_US.admin.UTF-8.po`
|
||||
`msgfmt -o www/includes/locale/ja/LC_MESSAGES/frontend.mo 4dev/lang/ja.admin.po`
|
||||
|
||||
@@ -7,7 +7,10 @@ if [ ! -f "locale/en_US/LC_MESSAGES/admin.mo" ]; then
|
||||
exit;
|
||||
fi;
|
||||
|
||||
msgfmt -o locale/en_US/LC_MESSAGES/admin.mo locale/en_US.admin.UTF-8.po
|
||||
msgfmt -o locale/en_US/LC_MESSAGES/frontend.mo locale/en_US.frontend.UTF-8.po
|
||||
msgfmt -o locale/ja_JP/LC_MESSAGES/admin.mo locale/ja_JP.admin.UTF-8.po
|
||||
msgfmt -o locale/ja_JP/LC_MESSAGES/frontend.mo locale/ja_JP.frontend.UTF-8.po
|
||||
for file in $(ls -1 locale/*.po); do
|
||||
echo $file;
|
||||
file=$(basename $file .po);
|
||||
locale=$(echo "${file}" | cut -d "-" -f 1);
|
||||
domain=$(echo "${file}" | cut -d "-" -f 2);
|
||||
msgfmt -o locale/${locale}/LC_MESSAGES/${domain}.mo locale/${locale}-${domain}.po;
|
||||
done;
|
||||
|
||||
@@ -353,7 +353,8 @@ class GetTextReader
|
||||
$expr .= ';';
|
||||
$res = '';
|
||||
$p = 0;
|
||||
for ($i = 0; $i < strlen($expr); $i++) {
|
||||
$expr_len = strlen($expr);
|
||||
for ($i = 0; $i < $expr_len; $i++) {
|
||||
$ch = $expr[$i];
|
||||
switch ($ch) {
|
||||
case '?':
|
||||
@@ -433,6 +434,7 @@ class GetTextReader
|
||||
$total = 0;
|
||||
$plural = 0;
|
||||
|
||||
// FIXME use Symfony\Component\ExpressionLanguage\ExpressionLanguage or similar
|
||||
eval("$string");
|
||||
/** @phpstan-ignore-next-line 0 >= 0 is always true*/
|
||||
if ($plural >= $total) {
|
||||
|
||||
Reference in New Issue
Block a user