diff options
Diffstat (limited to 'common/app/l10n')
-rw-r--r-- | common/app/l10n/en.lang | 270 | ||||
-rwxr-xr-x | common/app/l10n/extract.php | 201 | ||||
-rwxr-xr-x | common/app/l10n/fr.lang | 216 |
3 files changed, 687 insertions, 0 deletions
diff --git a/common/app/l10n/en.lang b/common/app/l10n/en.lang new file mode 100644 index 0000000..64d5a82 --- /dev/null +++ b/common/app/l10n/en.lang @@ -0,0 +1,270 @@ +# Translation note: ** String needs translation ** +;Are you sure you want to purge the cache? +Are you sure you want to purge the cache? + + +# Translation note: ** String needs translation ** +;Clear cache +Clear cache + + +# Translation note: ** String needs translation ** +;Clear cache: +Clear cache: + + +# Translation note: ** String needs translation ** +;Clear +Clear + + +# Translation note: ** String needs translation ** +;Clearing the cache will make moonmoon reload all feeds. +Clearing the cache will make moonmoon reload all feeds. + + +# Translation note: ** String needs translation ** +;Change administrator password +Change administrator password + + +# Translation note: ** String needs translation ** +;New password: +New password: + + +# Translation note: ** String needs translation ** +;Change password +Change password + + +# Translation note: ** String needs translation ** +;Add Feed +Add Feed + + +# Translation note: ** String needs translation ** +;Link: +Link: + + +# Translation note: ** String needs translation ** +;Accepted formats are RSS and ATOM. If the link is not a feed, moonmoon will try to autodiscover the feed. +Accepted formats are RSS and ATOM. If the link is not a feed, moonmoon will try to autodiscover the feed. + + +# Translation note: ** String needs translation ** +;Manage existing feeds +Manage existing feeds + + +# Translation note: ** String needs translation ** +;Number of feeds: %s +Number of feeds: %s + + +# Translation note: ** String needs translation ** +;Save changes +Save changes + + +# Translation note: ** String needs translation ** +;Delete selected Feeds +Delete selected Feeds + + +# Translation note: ** String needs translation ** +;Select : +Select : + + +# Translation note: ** String needs translation ** +;All +All + + +# Translation note: ** String needs translation ** +;None +None + + +# Translation note: ** String needs translation ** +;Selection +Selection + + +# Translation note: ** String needs translation ** +;Name +Name + + +# Translation note: ** String needs translation ** +;Last entry +Last entry + + +# Translation note: ** String needs translation ** +;Website link +Website link + + +# Translation note: ** String needs translation ** +;Feed link +Feed link + + +# Translation note: ** String needs translation ** +;Not in cache +Not in cache + + +# Translation note: ** String needs translation ** +;Password: +Password: + + +# Translation note: ** String needs translation ** +;OK +OK + + +# Translation note: ** String needs translation ** +;moonmoon administration +moonmoon administration + + +# Translation note: ** String needs translation ** +;Back to main page +Back to main page + + +# Translation note: ** String needs translation ** +;Logout +Logout + + +# Translation note: ** String needs translation ** +;Feeds +Feeds + + +# Translation note: ** String needs translation ** +;Administration +Administration + + +# Translation note: ** String needs translation ** +;Powered by <a %s>moonmoon</a> +Powered by <a %s>moonmoon</a> + + +# Translation note: ** String needs translation ** +;No article +No article + + +# Translation note: ** String needs translation ** +;No news, good news. +No news, good news. + + +# Translation note: ** String needs translation ** +;Today +Today + + +# Translation note: ** String needs translation ** +;Go to original place +Go to original place + + +# Translation note: ** String needs translation ** +;This week +This week + + +# Translation note: ** String needs translation ** +;This month +This month + + +# Translation note: ** String needs translation ** +;Older items +Older items + + +# Translation note: ** String needs translation ** +;People +People + + +# Translation note: ** String needs translation ** +;Feed +Feed + + +# Translation note: ** String needs translation ** +;Website +Website + + +# Translation note: ** String needs translation ** +;All feeds in OPML format +All feeds in OPML format + + +# Translation note: ** String needs translation ** +;Syndicate +Syndicate + + +# Translation note: ** String needs translation ** +;Feed (ATOM) +Feed (ATOM) + + +# Translation note: ** String needs translation ** +;Archives +Archives + + +# Translation note: ** String needs translation ** +;See all headlines +See all headlines + + +# Translation note: ** String needs translation ** +;Source: +Source: + + +# Translation note: ** String needs translation ** +;You might want to <a href="install.php">install moonmoon</a>. +You might want to <a href="install.php">install moonmoon</a>. + + +# Translation note: ** String needs translation ** +;moonmoon installation +moonmoon installation + + +# Translation note: ** String needs translation ** +;Congratulations! Your moonmoon is ready. +Congratulations! Your moonmoon is ready. + + +# Translation note: ** String needs translation ** +;What's next? +What's next? + + +# Translation note: ** String needs translation ** +;<strong>Delete</strong> <code>install.php</code> with your FTP software. +<strong>Delete</strong> <code>install.php</code> with your FTP software. + + +# Translation note: ** String needs translation ** +;Use your password to go to the <a href="./admin/">administration panel</a> +Use your password to go to the <a href="./admin/">administration panel</a> + + diff --git a/common/app/l10n/extract.php b/common/app/l10n/extract.php new file mode 100755 index 0000000..1a04f00 --- /dev/null +++ b/common/app/l10n/extract.php @@ -0,0 +1,201 @@ +<?php + +/* + * This is a file parser to extract localizable strings from moonmoon + * + * It will scan the whole moonmoon repository for php files, extract + * localized strings and their localization notes and create .lang files. + * Existing translations will be automatically updated. + * A short report will be displayed afterwards. + * + * The easiest way to add a new locale is just to create an empty .lang file and then run the script + * + * The script scans for the files in the l10n/ folder to know which locales are supported + */ + +// released versions of moonmoon should immediately return for security +// return; + +$root = dirname(__FILE__) . '/../../'; +$GLOBALS['english'] = array(); + +include_once $root . '/app/classes/Simplel10n.class.php'; + +/* + * This is a file parser to extract localizable strings (in .php files) + * $GLOBALS['english'] is populated with localizable strings and their associated localization notes + * + */ + + +function extract_l10n_strings($file) { + $lines = file($file); + $patterns = array('/_g\([\'"](.*?)[\'"]\)/', '/getString\([\'"](.*?)[\'"]\)/',); + + foreach ($lines as $line) { + + // Skip comments + if($line[0] == '#' || $line[0] == '/') continue; + + // parsing logic + foreach($patterns as $pattern) { + if(preg_match_all($pattern, $line, $matches, PREG_PATTERN_ORDER)) { + foreach($matches[1] as $val) { + + // Do not extract php variables calls or empty strings + if($val[0] == '$' || $val == '') continue; + + // Is there a localization comment ? + $l10n_note = explode("',", $val); + + // Also test strings in double quotes + if(count($l10n_note) == 1) { + $l10n_note = explode('",', $val); + } + + // Extract cleaned up strings + if(count($l10n_note) == 2) { + $l10n_str = trim($l10n_note[0]); + $l10n_note = trim(substr(trim($l10n_note[1]),1)); # Remove quote at begining of string + } else { + $l10n_str = trim($val); + $l10n_note = ''; + } + + if(!array_key_exists($l10n_str, $GLOBALS['english'])) { + $GLOBALS['english'][$l10n_str] = array($l10n_str, $l10n_note); + } + } + } + } + } +} + +/* + * This is a function echoing $GLOBALS['english'] in .lang format + * Typical usage would be: + * <?php + * extract_l10n_strings('.'); + * show_l10n_strings() ; + */ + +function show_l10n_strings() { + + header('Content-Type:text/plain'); + + foreach($GLOBALS['english'] as $val) { + if($val[1]) { + echo '# ' . $val[1] . "\n"; + } + echo ";$val[0]\n"; + echo "$val[0]\n\n\n"; + } +} + +/* + * Recursively scan files in a folder + * returns an array of file paths + */ + +function find_all_files($dir) { + + $result = array(); + $root = scandir($dir); + + $ignore = array('.', '..', '.git', '.svn', '.hg', 'cache', '.gitignore', 'lib'); + + foreach($root as $value) { + + if(in_array($value, $ignore)) { + continue; + } + + if(is_file("$dir/$value")) { + $split = explode('.', $value); + if(end($split) == 'php'){ + $result[] = "$dir/$value"; + } + continue; + } + + foreach(find_all_files("$dir/$value") as $value) { + $result[]=$value; + } + } + + return $result; +} + +function update_lang_files($source, $dest) { + + $files = find_all_files($source); + + foreach($files as $file) { + extract_l10n_strings($file); + } + + + $files = scandir($dest); + $ignore = array('.', '..'); + + + // list locales + $locales = array(); + foreach($files as $file) { + + if(in_array($file, $ignore)) { + continue; + } + + $split = explode('.', $file); + + if($split[1] == 'lang') { + $locales[] = $split[0]; + } + } + + + foreach($locales as $locale) { + $status[$locale] = 0; + $lang_file_path = $dest . '/' . $locale; + + Simplel10n::load($lang_file_path); + + ob_start(); + foreach($GLOBALS['english'] as $key => $val) { + $warning = ''; + $value = @Simplel10n::extractString($key); + + if($value == $val[0]) { + $status[$locale]++; + $warning = ' ** String needs translation **'; + } + + if($val[1]) { + echo '# Translation note: ' . $val[1] . $warning . "\n"; + } elseif($warning != '') { + echo '# Translation note: ' . $warning . "\n"; + } + + echo ";$val[0]\n"; + echo $value . "\n\n\n"; + } + + $content = ob_get_contents(); + ob_end_clean(); + file_put_contents($lang_file_path. '.lang', $content); + + unset($GLOBALS['locale']); + } + + + // Display a short status report + header('Content-Type:text/plain'); + echo "Number of English strings: " . count($GLOBALS['english']) . "\n"; + echo "Your installation has these languages installed: " . implode(', ', $locales) . "\n"; + foreach($locales as $val) { + echo $val . " has " . $status[$val] . " untranslated strings.\n"; + } +} + +update_lang_files($root, $root . 'app/l10n'); diff --git a/common/app/l10n/fr.lang b/common/app/l10n/fr.lang new file mode 100755 index 0000000..6247652 --- /dev/null +++ b/common/app/l10n/fr.lang @@ -0,0 +1,216 @@ +;Are you sure you want to purge the cache? +Êtes-vous sûr de vouloir vider le cache ? + + +;Clear cache +Vider le cache + + +;Clear cache: +Vider le cache : + + +;Clear +Vider + + +;Clearing the cache will make moonmoon reload all feeds. +Vider le cache forcera moonmoon à recharger tous les flux. + + +;Change administrator password +Changer le mot de passe de l'administrateur + + +;New password: +Nouveau mot de passe : + + +;Change password +Changer le mot de passe + + +;Add Feed +Ajouter un flux + + +;Link: +Lien : + + +;Accepted formats are RSS and ATOM. If the link is not a feed, moonmoon will try to autodiscover the feed. +Les formats valides sont RSS et ATOM. Si le lien n'est pas un flux, moonmoon essaiera de trouver le flux automatiquement. + + +;Manage existing feeds +Gérer les flux + + +;Number of feeds: %s +Nombre de flux : %s + + +;Save changes +Enregistrer les changements + + +;Delete selected Feeds +Effacer les flux sélectionnés + + +;Select : +Sélectionner + + +;All +Tout + + +;None +Aucun + + +;Selection +Sélection + + +;Name +Titre + + +;Last entry +Dernière entrée + + +;Website link +Lien du site + + +;Feed link +Lien du Flux + + +;Not in cache +Pas en cache + + +;Password: +Mot de passe : + + +;OK +OK {ok} + + +;moonmoon administration +Administration de moonmoon + + +;Back to main page +Retour à l'accueil + + +;Logout +Déconnexion + + +;Feeds +Flux + + +;Administration +Administration {ok} + + +;Powered by <a %s>moonmoon</a> +Propulsé par <a %s>moonmoon</a> + + +;No article +Pas d'articles + + +;No news, good news. +Pas de nouvelles, bonne nouvelle. + + +;Today +Aujourd'hui + + +;Go to original place +Aller à l'emplacement d'origine + + +;This week +Cette semaine + + +;This month +Ce mois + + +;Older items +Billets plus anciens + + +;People +Personnes + + +;Feed +Flux + + +;Website +Site Web + + +;All feeds in OPML format +Tous les flux au format OPML + + +;Syndicate +Syndiquer + + +;Feed (ATOM) +Flux (ATOM) + + +;Archives +Archives{ok} + + +;See all headlines +Afficher tous les titres + + +;Source: +Source : + + +;You might want to <a href="install.php">install moonmoon</a>. +Vous voulez probablement <a href="install.php">installer moonmoon</a>. + + +;moonmoon installation +Installation de moonmoon + + +;Congratulations! Your moonmoon is ready. +Félicitations ! Votre moonmoon est prêt. + + +;What's next? +Et maintenant ? + + +;<strong>Delete</strong> <code>install.php</code> with your FTP software. +<strong>Effacez</strong> <code>install.php</code> avec votre logiciel FTP. + + +;Use your password to go to the <a href="./admin/">administration panel</a> +Utilisez votre mot de passe pour vous rendre sur la <a href="./admin/">console d'administration</a> + + |