From 4d491d704e7c94ac88652bb9766043b5c544eca1 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Wed, 19 Mar 2014 21:56:42 -0700 Subject: [PATCH] Translate numbers in ar, bn, fa --- adminer/include/editing.inc.php | 2 +- adminer/include/functions.inc.php | 8 ++++++++ adminer/include/lang.inc.php | 2 +- adminer/lang/ar.inc.php | 1 + adminer/lang/bn.inc.php | 1 + adminer/lang/ca.inc.php | 1 + adminer/lang/cs.inc.php | 1 + adminer/lang/de.inc.php | 1 + adminer/lang/es.inc.php | 1 + adminer/lang/et.inc.php | 1 + adminer/lang/fa.inc.php | 1 + adminer/lang/fr.inc.php | 3 ++- adminer/lang/hu.inc.php | 1 + adminer/lang/id.inc.php | 1 + adminer/lang/it.inc.php | 1 + adminer/lang/ja.inc.php | 1 + adminer/lang/ko.inc.php | 1 + adminer/lang/lt.inc.php | 1 + adminer/lang/nl.inc.php | 1 + adminer/lang/no.inc.php | 1 + adminer/lang/pl.inc.php | 1 + adminer/lang/pt-br.inc.php | 1 + adminer/lang/pt.inc.php | 1 + adminer/lang/ro.inc.php | 1 + adminer/lang/ru.inc.php | 1 + adminer/lang/sk.inc.php | 1 + adminer/lang/sl.inc.php | 1 + adminer/lang/sr.inc.php | 1 + adminer/lang/ta.inc.php | 1 + adminer/lang/th.inc.php | 1 + adminer/lang/tr.inc.php | 1 + adminer/lang/uk.inc.php | 1 + adminer/lang/xx.inc.php | 3 ++- adminer/lang/zh-tw.inc.php | 1 + adminer/lang/zh.inc.php | 1 + adminer/script.inc.php | 4 ++-- changes.txt | 1 + compile.php | 2 +- editor/db.inc.php | 2 +- 39 files changed, 49 insertions(+), 8 deletions(-) diff --git a/adminer/include/editing.inc.php b/adminer/include/editing.inc.php index 71bd5bc0..e0e320a6 100644 --- a/adminer/include/editing.inc.php +++ b/adminer/include/editing.inc.php @@ -519,5 +519,5 @@ function db_size($db) { foreach (table_status() as $table_status) { $return += $table_status["Data_length"] + $table_status["Index_length"]; } - return number_format($return, 0, '.', lang(',')); + return format_number($return); } diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index ac8d2d4d..117248cb 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -723,6 +723,14 @@ function shorten_utf8($string, $length = 80, $suffix = "") { return h($match[1]) . $suffix . (isset($match[2]) ? "" : "..."); } +/** Format decimal number +* @param int +* @return string +*/ +function format_number($val) { + return strtr(number_format($val, 0, ".", lang(',')), preg_split('~~u', lang('0123456789'), -1, PREG_SPLIT_NO_EMPTY)); +} + /** Generate friendly URL * @param string * @return string diff --git a/adminer/include/lang.inc.php b/adminer/include/lang.inc.php index 8b03548f..860605f4 100644 --- a/adminer/include/lang.inc.php +++ b/adminer/include/lang.inc.php @@ -68,7 +68,7 @@ function lang($idf, $number = null) { array_shift($args); $format = str_replace("%d", "%s", $translation); if ($format != $translation) { - $args[0] = number_format($number, 0, ".", lang(',')); + $args[0] = format_number($number); } return vsprintf($format, $args); } diff --git a/adminer/lang/ar.inc.php b/adminer/lang/ar.inc.php index e3824f90..17377334 100644 --- a/adminer/lang/ar.inc.php +++ b/adminer/lang/ar.inc.php @@ -177,6 +177,7 @@ $translations = array( 'Data Free' => 'المساحة الحرة', 'Rows' => 'الأسطر', ',' => ',', + '0123456789' => '٠١٢٣٤٥٦٧٨٩', 'Analyze' => 'تحليل', 'Optimize' => 'تحسين', 'Check' => 'فحص', diff --git a/adminer/lang/bn.inc.php b/adminer/lang/bn.inc.php index 2c9a5f5c..d3c10ad9 100644 --- a/adminer/lang/bn.inc.php +++ b/adminer/lang/bn.inc.php @@ -179,6 +179,7 @@ $translations = array( 'Tables have been truncated.' => 'টেবিল ছাঁটাই করা হয়েছে', 'Rows' => 'সারি', ',' => ',', + '0123456789' => '০১২৩৪৫৬৭৮৯', 'Tables have been moved.' => 'টেবিল স্থানান্তর করা হয়েছে।', 'Move to other database' => 'অন্য ডাটাবেজে স্থানান্তর করো', 'Move' => 'স্থানান্তর করো', diff --git a/adminer/lang/ca.inc.php b/adminer/lang/ca.inc.php index eb0f50b2..f818ccc5 100644 --- a/adminer/lang/ca.inc.php +++ b/adminer/lang/ca.inc.php @@ -179,6 +179,7 @@ $translations = array( 'Tables have been truncated.' => 'S\'han escapçat les taules.', 'Rows' => 'Files', ',' => ',', + '0123456789' => '0123456789', 'Tables have been moved.' => 'S\'han desplaçat les taules.', 'Move to other database' => 'Desplaça a una altra base de dades', 'Move' => 'Desplaça', diff --git a/adminer/lang/cs.inc.php b/adminer/lang/cs.inc.php index 77bd8e00..9e0cf067 100644 --- a/adminer/lang/cs.inc.php +++ b/adminer/lang/cs.inc.php @@ -95,6 +95,7 @@ $translations = array( // thousands separator - must contain single byte ',' => ' ', + '0123456789' => '0123456789', 'Engine' => 'Úložiště', 'Collation' => 'Porovnávání', 'Data Length' => 'Velikost dat', diff --git a/adminer/lang/de.inc.php b/adminer/lang/de.inc.php index dabcceb3..d40a18aa 100644 --- a/adminer/lang/de.inc.php +++ b/adminer/lang/de.inc.php @@ -179,6 +179,7 @@ $translations = array( 'Tables have been truncated.' => 'Tabellen sind entleert worden (truncate).', 'Rows' => 'Datensätze', ',' => ' ', + '0123456789' => '0123456789', 'Tables have been moved.' => 'Tabellen verschoben.', 'Move to other database' => 'In andere Datenbank verschieben', 'Move' => 'Verschieben', diff --git a/adminer/lang/es.inc.php b/adminer/lang/es.inc.php index 6228e14b..52b63024 100644 --- a/adminer/lang/es.inc.php +++ b/adminer/lang/es.inc.php @@ -179,6 +179,7 @@ $translations = array( 'Tables have been truncated.' => 'Tablas vaciadas (truncate).', 'Rows' => 'Registros', ',' => ' ', + '0123456789' => '0123456789', 'Tables have been moved.' => 'Se movieron las tablas.', 'Move to other database' => 'Mover a otra base de datos', 'Move' => 'Mover', diff --git a/adminer/lang/et.inc.php b/adminer/lang/et.inc.php index 519cf159..78e4989d 100644 --- a/adminer/lang/et.inc.php +++ b/adminer/lang/et.inc.php @@ -179,6 +179,7 @@ $translations = array( 'Data Free' => 'Vaba ruumi', 'Rows' => 'Ridu', ',' => ',', + '0123456789' => '0123456789', 'Analyze' => 'Analüüsi', 'Optimize' => 'Optimeeri', 'Check' => 'Kontrolli', diff --git a/adminer/lang/fa.inc.php b/adminer/lang/fa.inc.php index cb2e0e6f..e0ae8537 100644 --- a/adminer/lang/fa.inc.php +++ b/adminer/lang/fa.inc.php @@ -93,6 +93,7 @@ $translations = array( // thousands separator - must contain single byte ',' => ' ', + '0123456789' => '۰۱۲۳۴۵۶۷۸۹', 'Engine' => 'موتور', 'Collation' => 'تطبیق', 'Data Length' => 'طول داده', diff --git a/adminer/lang/fr.inc.php b/adminer/lang/fr.inc.php index 850dbd87..c1b68925 100644 --- a/adminer/lang/fr.inc.php +++ b/adminer/lang/fr.inc.php @@ -177,6 +177,7 @@ $translations = array( 'Data Free' => 'Espace inutilisé', 'Rows' => 'Lignes', ',' => ',', + '0123456789' => '0123456789', 'Analyze' => 'Analyser', 'Optimize' => 'Optimiser', 'Check' => 'Vérifier', @@ -192,7 +193,7 @@ $translations = array( 'Partitions' => 'Partitions', 'Partition name' => 'Nom de la partition', 'Values' => 'Valeurs', - '%d row(s) have been imported.' => array('%d ligne a été importée.','%d lignes ont été importées.'), + '%d row(s) have been imported.' => array('%d ligne a été importée.', '%d lignes ont été importées.'), 'anywhere' => 'n\'importe où', 'Import' => 'Importer', 'Stop on error' => 'Arrêter en cas d\'erreur', diff --git a/adminer/lang/hu.inc.php b/adminer/lang/hu.inc.php index a10fc414..b433f616 100644 --- a/adminer/lang/hu.inc.php +++ b/adminer/lang/hu.inc.php @@ -179,6 +179,7 @@ $translations = array( 'Tables have been truncated.' => 'A tábla felszabadítva.', 'Rows' => 'Oszlop', ',' => ' ', + '0123456789' => '0123456789', 'Tables have been moved.' => 'Táblák áthelyezve.', 'Move to other database' => 'Áthelyezés másik adatbázisba', 'Move' => 'Áthelyez', diff --git a/adminer/lang/id.inc.php b/adminer/lang/id.inc.php index 668c55b1..fec8743e 100644 --- a/adminer/lang/id.inc.php +++ b/adminer/lang/id.inc.php @@ -93,6 +93,7 @@ $translations = array( // thousands separator - must contain single byte ',' => '.', + '0123456789' => '0123456789', 'Engine' => 'Mesin', 'Collation' => 'Kolasi', 'Data Length' => 'Panjang Data', diff --git a/adminer/lang/it.inc.php b/adminer/lang/it.inc.php index 9ff7e928..bb1ea0bc 100644 --- a/adminer/lang/it.inc.php +++ b/adminer/lang/it.inc.php @@ -179,6 +179,7 @@ $translations = array( 'Data Free' => 'Dati liberi', 'Rows' => 'Righe', ',' => '.', + '0123456789' => '0123456789', 'Analyze' => 'Analizza', 'Optimize' => 'Ottimizza', 'Check' => 'Controlla', diff --git a/adminer/lang/ja.inc.php b/adminer/lang/ja.inc.php index 7bdc6f43..3bc24757 100644 --- a/adminer/lang/ja.inc.php +++ b/adminer/lang/ja.inc.php @@ -175,6 +175,7 @@ $translations = array( 'Data Free' => '空き', 'Rows' => '行数', ',' => ',', + '0123456789' => '0123456789', 'Analyze' => '分析', 'Optimize' => '最適化', 'Check' => 'チェック', diff --git a/adminer/lang/ko.inc.php b/adminer/lang/ko.inc.php index 199f863c..fe297e0d 100644 --- a/adminer/lang/ko.inc.php +++ b/adminer/lang/ko.inc.php @@ -175,6 +175,7 @@ $translations = array( 'Data Free' => '여유', 'Rows' => '행', ',' => ',', + '0123456789' => '0123456789', 'Analyze' => '분석', 'Optimize' => '최적화', 'Check' => '확인', diff --git a/adminer/lang/lt.inc.php b/adminer/lang/lt.inc.php index 1f524afa..72e4a140 100644 --- a/adminer/lang/lt.inc.php +++ b/adminer/lang/lt.inc.php @@ -93,6 +93,7 @@ $translations = array( // thousands separator - must contain single byte ',' => ' ', + '0123456789' => '0123456789', 'Engine' => 'Variklis', 'Collation' => 'Lyginimas', 'Data Length' => 'Duomenų ilgis', diff --git a/adminer/lang/nl.inc.php b/adminer/lang/nl.inc.php index 363bc9dc..ceccffc8 100644 --- a/adminer/lang/nl.inc.php +++ b/adminer/lang/nl.inc.php @@ -180,6 +180,7 @@ $translations = array( 'Data Free' => 'Data Vrij', 'Rows' => 'Rijen', ',' => '.', + '0123456789' => '0123456789', 'Analyze' => 'Analyseer', 'Optimize' => 'Optimaliseer', 'Check' => 'Controleer', diff --git a/adminer/lang/no.inc.php b/adminer/lang/no.inc.php index 9618eea4..15d66c80 100644 --- a/adminer/lang/no.inc.php +++ b/adminer/lang/no.inc.php @@ -80,6 +80,7 @@ $translations = array( 'Database schema' => 'Databaseskjema', 'Permanent link' => 'Permanent lenke', ',' => ' ', + '0123456789' => '0123456789', 'Engine' => 'Motor', 'Collation' => 'Tekstsortering', 'Data Length' => 'Datalengde', diff --git a/adminer/lang/pl.inc.php b/adminer/lang/pl.inc.php index 4d5f80b7..38523ec7 100644 --- a/adminer/lang/pl.inc.php +++ b/adminer/lang/pl.inc.php @@ -95,6 +95,7 @@ $translations = array( // thousands separator - must contain single byte ',' => ' ', + '0123456789' => '0123456789', 'Engine' => 'Składowanie', 'Collation' => 'Porównywanie znaków', 'Data Length' => 'Rozmiar danych', diff --git a/adminer/lang/pt-br.inc.php b/adminer/lang/pt-br.inc.php index ca4b75f8..e7150de2 100644 --- a/adminer/lang/pt-br.inc.php +++ b/adminer/lang/pt-br.inc.php @@ -179,6 +179,7 @@ $translations = array( 'Tables have been truncated.' => 'As Tabelas foram truncadas.', 'Rows' => 'Registros', ',' => ' ', + '0123456789' => '0123456789', 'Tables have been moved.' => 'As Tabelas foram movidas.', 'Move to other database' => 'Mover para outra Base de dados', 'Move' => 'Mover', diff --git a/adminer/lang/pt.inc.php b/adminer/lang/pt.inc.php index f492b8f4..8740027d 100644 --- a/adminer/lang/pt.inc.php +++ b/adminer/lang/pt.inc.php @@ -179,6 +179,7 @@ $translations = array( 'Tables have been truncated.' => 'Tabelas truncadas (truncate).', 'Rows' => 'Registos', ',' => ' ', + '0123456789' => '0123456789', 'Tables have been moved.' => 'As Tabelas foram movidas.', 'Move to other database' => 'Mover outra Base de dados', 'Move' => 'Mover', diff --git a/adminer/lang/ro.inc.php b/adminer/lang/ro.inc.php index 150e7963..8717e35c 100644 --- a/adminer/lang/ro.inc.php +++ b/adminer/lang/ro.inc.php @@ -179,6 +179,7 @@ $translations = array( 'Tables have been truncated.' => 'Tabelele au fost curățate.', 'Rows' => 'Înscrieri', ',' => ',', + '0123456789' => '0123456789', 'Tables have been moved.' => 'Tabelele au fost mutate.', 'Move to other database' => 'Mută în altă bază de date', 'Move' => 'Mută', diff --git a/adminer/lang/ru.inc.php b/adminer/lang/ru.inc.php index 441f29fb..58369817 100644 --- a/adminer/lang/ru.inc.php +++ b/adminer/lang/ru.inc.php @@ -179,6 +179,7 @@ $translations = array( 'Tables have been truncated.' => 'Таблицы были очищены.', 'Rows' => 'Строк', ',' => ' ', + '0123456789' => '0123456789', 'Tables have been moved.' => 'Таблицы были перемещены.', 'Move to other database' => 'Переместить в другую базу данных', 'Move' => 'Переместить', diff --git a/adminer/lang/sk.inc.php b/adminer/lang/sk.inc.php index b30094ca..422b5deb 100644 --- a/adminer/lang/sk.inc.php +++ b/adminer/lang/sk.inc.php @@ -180,6 +180,7 @@ $translations = array( 'Data Free' => 'Voľné miesto', 'Rows' => 'Riadky', ',' => ' ', + '0123456789' => '0123456789', 'Analyze' => 'Analyzovať', 'Optimize' => 'Optimalizovať', 'Check' => 'Skontrolovať', diff --git a/adminer/lang/sl.inc.php b/adminer/lang/sl.inc.php index c11cd905..a37af1ac 100644 --- a/adminer/lang/sl.inc.php +++ b/adminer/lang/sl.inc.php @@ -89,6 +89,7 @@ $translations = array( // thousands separator - must contain single byte ',' => ' ', + '0123456789' => '0123456789', 'Engine' => 'Pogon', 'Collation' => 'Zbiranje', 'Data Length' => 'Velikost podatkov', diff --git a/adminer/lang/sr.inc.php b/adminer/lang/sr.inc.php index 05513c09..5638acca 100644 --- a/adminer/lang/sr.inc.php +++ b/adminer/lang/sr.inc.php @@ -93,6 +93,7 @@ $translations = array( // thousands separator - must contain single byte ',' => ',', + '0123456789' => '0123456789', 'Engine' => 'Механизам', 'Collation' => 'Сравњивање', 'Data Length' => 'Дужина података', diff --git a/adminer/lang/ta.inc.php b/adminer/lang/ta.inc.php index f96480f4..deb2b0aa 100644 --- a/adminer/lang/ta.inc.php +++ b/adminer/lang/ta.inc.php @@ -176,6 +176,7 @@ $translations = array( 'Tables have been truncated.' => 'அட்ட‌வ‌ணை குறைக்க‌ப்ப‌ட்ட‌து (truncated).', 'Rows' => 'வ‌ரிசைக‌ள்', ',' => ',', + '0123456789' => '0123456789', 'Tables have been moved.' => 'அட்ட‌வ‌ணை ந‌க‌ர்த்த‌ப்ப‌ட்ட‌து.', 'Move to other database' => 'ம‌ற்ற‌ த‌க‌வ‌ல் தள‌த்திற்க்கு ந‌க‌ர்த்து', 'Move' => 'ந‌க‌ர்த்து', diff --git a/adminer/lang/th.inc.php b/adminer/lang/th.inc.php index eb1d59d2..e3221a5a 100644 --- a/adminer/lang/th.inc.php +++ b/adminer/lang/th.inc.php @@ -179,6 +179,7 @@ $translations = array( 'Tables have been truncated.' => 'เคลียร์ตารางแล้ว (truncate).', 'Rows' => 'แถว', ',' => ' ', + '0123456789' => '0123456789', 'Tables have been moved.' => 'ตารางถูกย้ายแล้ว.', 'Move to other database' => 'ย้ายไปยังฐานข้อมูลอื่น', 'Move' => 'ย้าย', diff --git a/adminer/lang/tr.inc.php b/adminer/lang/tr.inc.php index 15ea36de..45f0a538 100644 --- a/adminer/lang/tr.inc.php +++ b/adminer/lang/tr.inc.php @@ -93,6 +93,7 @@ $translations = array( // thousands separator - must contain single byte ',' => ' ', + '0123456789' => '0123456789', 'Engine' => 'Motor', 'Collation' => 'Karşılaştırma', 'Data Length' => 'Veri Uzunluğu', diff --git a/adminer/lang/uk.inc.php b/adminer/lang/uk.inc.php index 36eb40de..3114dc60 100644 --- a/adminer/lang/uk.inc.php +++ b/adminer/lang/uk.inc.php @@ -93,6 +93,7 @@ $translations = array( // thousands separator - must contain single byte ',' => ' ', + '0123456789' => '0123456789', 'Engine' => 'Рушій', 'Collation' => 'Співставлення', 'Data Length' => 'Об\'єм даних', diff --git a/adminer/lang/xx.inc.php b/adminer/lang/xx.inc.php index ffb57deb..e031726e 100644 --- a/adminer/lang/xx.inc.php +++ b/adminer/lang/xx.inc.php @@ -94,7 +94,8 @@ $translations = array( 'Permanent link' => 'xx', // thousands separator - must contain single byte - ',' => 'xx', + ',' => 'x', + '0123456789' => 'xxxxxxxxxx', 'Engine' => 'xx', 'Collation' => 'xx', 'Data Length' => 'xx', diff --git a/adminer/lang/zh-tw.inc.php b/adminer/lang/zh-tw.inc.php index 7ab683c7..6da780b4 100644 --- a/adminer/lang/zh-tw.inc.php +++ b/adminer/lang/zh-tw.inc.php @@ -174,6 +174,7 @@ $translations = array( 'Data Free' => '資料空閒', 'Rows' => '行數', ',' => ',', + '0123456789' => '0123456789', 'Analyze' => '分析', 'Optimize' => '最佳化', 'Check' => '檢查', diff --git a/adminer/lang/zh.inc.php b/adminer/lang/zh.inc.php index 72d1be30..fc44525b 100644 --- a/adminer/lang/zh.inc.php +++ b/adminer/lang/zh.inc.php @@ -176,6 +176,7 @@ $translations = array( 'Data Free' => '数据空闲', 'Rows' => '行数', ',' => ',', + '0123456789' => '0123456789', 'Analyze' => '分析', 'Optimize' => '优化', 'Check' => '检查', diff --git a/adminer/script.inc.php b/adminer/script.inc.php index ab850c5f..617ac114 100644 --- a/adminer/script.inc.php +++ b/adminer/script.inc.php @@ -12,7 +12,7 @@ if ($_GET["script"] == "db") { } foreach ($sums + array("Auto_increment" => 0, "Rows" => 0) as $key => $val) { if ($table_status[$key] != "") { - $val = number_format($table_status[$key], 0, '.', lang(',')); + $val = format_number($table_status[$key]); json_row("$key-$id", ($key == "Rows" && $val && $table_status["Engine"] == ($sql == "pgsql" ? "table" : "InnoDB") ? "~ $val" : $val @@ -28,7 +28,7 @@ if ($_GET["script"] == "db") { } } foreach ($sums as $key => $val) { - json_row("sum-$key", number_format($val, 0, '.', lang(','))); + json_row("sum-$key", format_number($val)); } json_row(""); diff --git a/changes.txt b/changes.txt index 537e0788..630586ad 100644 --- a/changes.txt +++ b/changes.txt @@ -12,6 +12,7 @@ MySQL 5.6.5+: Support ON UPDATE on datatime column SQLite: Support UPDATE OF triggers SQLite: Display auto-created unique indexes, bug since Adminer 3.5.0 Editor: Fix login() method, bug since Adminer 4.0.0 +Translate numbers in ar, bn, fa Adminer 4.0.3 (released 2014-02-01) MongoDB: insert, truncate, indexes diff --git a/compile.php b/compile.php index 62eaee78..0d62d5f2 100755 --- a/compile.php +++ b/compile.php @@ -70,7 +70,7 @@ function lang(\$translation, \$number = null) { $translation = $translation[$pos]; } $translation = str_replace("%d", "%s", $translation); - $number = number_format($number, 0, ".", lang(\',\')); + $number = format_number($number); return sprintf($translation, $number); } '; diff --git a/editor/db.inc.php b/editor/db.inc.php index d3625f5a..0fffc6f0 100644 --- a/editor/db.inc.php +++ b/editor/db.inc.php @@ -15,7 +15,7 @@ if ($adminer->homepage()) { if (isset($row["Engine"]) && $name != "") { echo '' . checkbox("tables[]", $table, in_array($table, (array) $_POST["tables"], true), "", "formUncheck('check-all');"); echo "$name"; - $val = number_format($row["Rows"], 0, '.', lang(',')); + $val = format_number($row["Rows"]); echo "" . ($row["Engine"] == "InnoDB" && $val ? "~ $val" : $val) . ""; } }