From 8c4d71da2ef1366c8fcd3e7dfb7f4566d2f905f4 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Fri, 5 Jun 2020 20:16:04 +0200 Subject: Add missing translations (#3034) * Add missing translations * Add a simple way to check if an i18n key exists There is a rule in the makefile to access it directly --- Makefile | 8 ++++++++ app/Controllers/extensionController.php | 2 +- app/i18n/cz/feedback.php | 2 ++ app/i18n/de/feedback.php | 2 ++ app/i18n/en/feedback.php | 2 ++ app/i18n/es/feedback.php | 2 ++ app/i18n/fr/feedback.php | 2 ++ app/i18n/he/feedback.php | 2 ++ app/i18n/it/feedback.php | 2 ++ app/i18n/kr/feedback.php | 2 ++ app/i18n/nl/feedback.php | 2 ++ app/i18n/oc/feedback.php | 2 ++ app/i18n/pt-br/feedback.php | 2 ++ app/i18n/ru/feedback.php | 2 ++ app/i18n/sk/feedback.php | 2 ++ app/i18n/tr/feedback.php | 2 ++ app/i18n/zh-cn/feedback.php | 2 ++ cli/i18n/I18nData.php | 17 +++++++++++++---- cli/manipulate.translation.php | 20 ++++++++++++++++++-- 19 files changed, 70 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 1e5433a44..b5b69e6bf 100644 --- a/Makefile +++ b/Makefile @@ -146,6 +146,14 @@ endif @$(PHP) ./cli/manipulate.translation.php -a ignore -k $(key) -l $(lang) @echo Key ignored. +.PHONY: i18n-key-exists +i18n-key-exists: ## Check if a translation key exists +ifndef key + @echo To check if a key exists, you need to provide one in the "key" variable. + @exit 10 +endif + @$(PHP) ./cli/manipulate.translation.php -a exist -k $(key) + ########### ## TOOLS ## ########### diff --git a/app/Controllers/extensionController.php b/app/Controllers/extensionController.php index 68bd90f4c..8ac45acc7 100644 --- a/app/Controllers/extensionController.php +++ b/app/Controllers/extensionController.php @@ -246,7 +246,7 @@ class FreshRSS_extension_Controller extends Minz_ActionController { Minz_Request::good(_t('feedback.extensions.removed', $ext_name), $url_redirect); } else { - Minz_Request::bad(_t('feedback.extensions.cannot_delete', $ext_name), + Minz_Request::bad(_t('feedback.extensions.cannot_remove', $ext_name), $url_redirect); } } diff --git a/app/i18n/cz/feedback.php b/app/i18n/cz/feedback.php index 426fe2e69..315be55aa 100644 --- a/app/i18n/cz/feedback.php +++ b/app/i18n/cz/feedback.php @@ -36,6 +36,7 @@ return array( ), 'extensions' => array( 'already_enabled' => '%s je již zapnut', + 'cannot_remove' => '%s cannot be removed', // TODO - Translation 'disable' => array( 'ko' => '%s nelze vypnout. Pro více detailů zkontrolujte logy FreshRSS.', 'ok' => '%s je nyní vypnut', @@ -47,6 +48,7 @@ return array( 'no_access' => 'Nemáte přístup k %s', 'not_enabled' => '%s není ještě zapnut', 'not_found' => '%s neexistuje', + 'removed' => '%s removed', // TODO - Translation ), 'import_export' => array( 'export_no_zip_extension' => 'Na serveru není naistalována podpora ZIP. Zkuste prosím exportovat soubory jeden po druhém.', diff --git a/app/i18n/de/feedback.php b/app/i18n/de/feedback.php index afd96bf33..e0c1db9b0 100644 --- a/app/i18n/de/feedback.php +++ b/app/i18n/de/feedback.php @@ -36,6 +36,7 @@ return array( ), 'extensions' => array( 'already_enabled' => '%s ist bereits aktiviert', + 'cannot_remove' => '%s cannot be removed', // TODO - Translation 'disable' => array( 'ko' => '%s kann nicht deaktiviert werden. Für Details prüfen Sie die FreshRSS-Protokolle.', 'ok' => '%s ist jetzt deaktiviert', @@ -47,6 +48,7 @@ return array( 'no_access' => 'Sie haben keinen Zugang zu %s', 'not_enabled' => '%s ist noch nicht aktiviert', 'not_found' => '%s existiert nicht', + 'removed' => '%s removed', // TODO - Translation ), 'import_export' => array( 'export_no_zip_extension' => 'Die ZIP-Erweiterung fehlt auf Ihrem Server. Bitte versuchen Sie die Dateien eine nach der anderen zu exportieren.', diff --git a/app/i18n/en/feedback.php b/app/i18n/en/feedback.php index 606a7ad6a..6d6796dda 100644 --- a/app/i18n/en/feedback.php +++ b/app/i18n/en/feedback.php @@ -36,6 +36,7 @@ return array( ), 'extensions' => array( 'already_enabled' => '%s is already enabled', + 'cannot_remove' => '%s cannot be removed', 'disable' => array( 'ko' => '%s cannot be disabled. Check FreshRSS logs for details.', 'ok' => '%s is now disabled', @@ -47,6 +48,7 @@ return array( 'no_access' => 'You have no access on %s', 'not_enabled' => '%s is not enabled', 'not_found' => '%s does not exist', + 'removed' => '%s removed', ), 'import_export' => array( 'export_no_zip_extension' => 'ZIP extension is not present on your server. Please try to export files one by one.', diff --git a/app/i18n/es/feedback.php b/app/i18n/es/feedback.php index 0a9af5e55..b0e76fc46 100755 --- a/app/i18n/es/feedback.php +++ b/app/i18n/es/feedback.php @@ -36,6 +36,7 @@ return array( ), 'extensions' => array( 'already_enabled' => '%s ya está activado', + 'cannot_remove' => '%s cannot be removed', // TODO - Translation 'disable' => array( 'ko' => '%s no se puede desactivar. Revisa el registro de FreshRSS para más información.', 'ok' => '%s ha quedado desactivado', @@ -47,6 +48,7 @@ return array( 'no_access' => 'No tienes acceso a %s', 'not_enabled' => '%s no está activado', 'not_found' => '%s no existe', + 'removed' => '%s removed', // TODO - Translation ), 'import_export' => array( 'export_no_zip_extension' => 'La extensión ZIP no está disponible en tu servidor. Por favor, exporta estos archivos uno a uno.', diff --git a/app/i18n/fr/feedback.php b/app/i18n/fr/feedback.php index a31c4f249..e09518892 100644 --- a/app/i18n/fr/feedback.php +++ b/app/i18n/fr/feedback.php @@ -36,6 +36,7 @@ return array( ), 'extensions' => array( 'already_enabled' => '%s est déjà activée', + 'cannot_remove' => '%s ne peut pas être supprimée', 'disable' => array( 'ko' => '%s ne peut pas être désactivée. Consulter les logs de FreshRSS pour plus de détails.', 'ok' => '%s est désormais désactivée', @@ -47,6 +48,7 @@ return array( 'no_access' => 'Vous n’avez aucun accès sur %s', 'not_enabled' => '%s n’est pas encore activée', 'not_found' => '%s n’existe pas', + 'removed' => '%s a été supprimée', ), 'import_export' => array( 'export_no_zip_extension' => 'L’extension ZIP n’est pas présente sur votre serveur. Veuillez essayer d’exporter les fichiers un par un.', diff --git a/app/i18n/he/feedback.php b/app/i18n/he/feedback.php index 10966b0ef..be5b74165 100644 --- a/app/i18n/he/feedback.php +++ b/app/i18n/he/feedback.php @@ -36,6 +36,7 @@ return array( ), 'extensions' => array( 'already_enabled' => '%s is already enabled', // TODO - Translation + 'cannot_remove' => '%s cannot be removed', // TODO - Translation 'disable' => array( 'ko' => '%s cannot be disabled. Check FreshRSS logs for details.', // TODO - Translation 'ok' => '%s is now disabled', // TODO - Translation @@ -47,6 +48,7 @@ return array( 'no_access' => 'You have no access on %s', // TODO - Translation 'not_enabled' => '%s is not enabled yet', 'not_found' => '%s does not exist', // TODO - Translation + 'removed' => '%s removed', // TODO - Translation ), 'import_export' => array( 'export_no_zip_extension' => 'הרחבת ZIP אינה מותקנת על השרת.', diff --git a/app/i18n/it/feedback.php b/app/i18n/it/feedback.php index af6275f97..d9c6cca75 100644 --- a/app/i18n/it/feedback.php +++ b/app/i18n/it/feedback.php @@ -36,6 +36,7 @@ return array( ), 'extensions' => array( 'already_enabled' => '%s è già abilitata', + 'cannot_remove' => '%s cannot be removed', // TODO - Translation 'disable' => array( 'ko' => '%s non può essere disabilitata. Verifica i logs per dettagli.', 'ok' => '%s è disabilitata', @@ -47,6 +48,7 @@ return array( 'no_access' => 'Accesso negato a %s', 'not_enabled' => '%s non abilitato', 'not_found' => '%s non disponibile', + 'removed' => '%s removed', // TODO - Translation ), 'import_export' => array( 'export_no_zip_extension' => 'Estensione ZIP non presente sul server. Per favore esporta i files singolarmente.', diff --git a/app/i18n/kr/feedback.php b/app/i18n/kr/feedback.php index 1ba91f2bd..e6745c3a5 100644 --- a/app/i18n/kr/feedback.php +++ b/app/i18n/kr/feedback.php @@ -36,6 +36,7 @@ return array( ), 'extensions' => array( 'already_enabled' => '%s 확장 기능은 이미 활성화되어 있습니다', + 'cannot_remove' => '%s cannot be removed', // TODO - Translation 'disable' => array( 'ko' => '%s 확장 기능을 비활성화 할 수 없습니다. 자세한 내용은 FreshRSS 로그를 참고하세요.', 'ok' => '%s 확장 기능이 비활성화되었습니다', @@ -47,6 +48,7 @@ return array( 'no_access' => '%s 확장 기능에 접근 권한이 없습니다', 'not_enabled' => '%s 확장 기능이 활성화되지 않았습니다', 'not_found' => '%s 확장 기능이 존재하지 않습니다', + 'removed' => '%s removed', // TODO - Translation ), 'import_export' => array( 'export_no_zip_extension' => 'ZIP 확장 기능을 서버에서 찾을 수 없습니다. 파일을 하나씩 내보내세요.', diff --git a/app/i18n/nl/feedback.php b/app/i18n/nl/feedback.php index d94a1b667..e9b1d62b0 100644 --- a/app/i18n/nl/feedback.php +++ b/app/i18n/nl/feedback.php @@ -36,6 +36,7 @@ return array( ), 'extensions' => array( 'already_enabled' => '%s is al ingeschakeld', + 'cannot_remove' => '%s cannot be removed', // TODO - Translation 'disable' => array( 'ko' => '%s kan niet worden uitgeschakeld. Controleer FreshRSS log bestanden voor details.', 'ok' => '%s is nu uitgeschakeld', @@ -47,6 +48,7 @@ return array( 'no_access' => 'U hebt geen toegang voor %s', 'not_enabled' => '%s is nog niet ingeschakeld', 'not_found' => '%s bestaat niet', + 'removed' => '%s removed', // TODO - Translation ), 'import_export' => array( 'export_no_zip_extension' => 'ZIP uitbreiding is niet aanwezig op uw server. Exporteer a.u.b. uw bestanden één voor één.', diff --git a/app/i18n/oc/feedback.php b/app/i18n/oc/feedback.php index b5f069938..7b1d28d40 100644 --- a/app/i18n/oc/feedback.php +++ b/app/i18n/oc/feedback.php @@ -36,6 +36,7 @@ return array( ), 'extensions' => array( 'already_enabled' => '%s es ja activada', + 'cannot_remove' => '%s cannot be removed', // TODO - Translation 'disable' => array( 'ko' => '%s pòt pas èsser desactivada. Consultatz los jornals d’audit de FreshRSS logs per mai de detalhs.', 'ok' => '%s es ara desactivada', @@ -47,6 +48,7 @@ return array( 'no_access' => 'Avètz pas accès sus %s', 'not_enabled' => '%s es pas encara activada', 'not_found' => '%s existís pas', + 'removed' => '%s removed', // TODO - Translation ), 'import_export' => array( 'export_no_zip_extension' => 'L\'extension ZIP es pas presenta sul servidor. Volgatz ensajar d\'exportar los fichièrs un per un.', diff --git a/app/i18n/pt-br/feedback.php b/app/i18n/pt-br/feedback.php index 184ef4cc4..0b903db13 100644 --- a/app/i18n/pt-br/feedback.php +++ b/app/i18n/pt-br/feedback.php @@ -36,6 +36,7 @@ return array( ), 'extensions' => array( 'already_enabled' => '%s já está habilitado', + 'cannot_remove' => '%s cannot be removed', // TODO - Translation 'disable' => array( 'ko' => '%s não pode ser desabilitado. verifique os logs do FreshRSS para detalhes.', 'ok' => '%s agora está desabilitado', @@ -47,6 +48,7 @@ return array( 'no_access' => 'Você não tem acesso ao %s', 'not_enabled' => '%s não está habilitado', 'not_found' => '%s não existe', + 'removed' => '%s removed', // TODO - Translation ), 'import_export' => array( 'export_no_zip_extension' => 'extensão ZIP não está presente em seu servidor. Por favor tente exportar os arquivos um por vez.', diff --git a/app/i18n/ru/feedback.php b/app/i18n/ru/feedback.php index 04ec06cf0..dbd6a7f52 100644 --- a/app/i18n/ru/feedback.php +++ b/app/i18n/ru/feedback.php @@ -36,6 +36,7 @@ return array( ), 'extensions' => array( 'already_enabled' => '%s is already enabled', // TODO - Translation + 'cannot_remove' => '%s cannot be removed', // TODO - Translation 'disable' => array( 'ko' => '%s cannot be disabled. Check FreshRSS logs for details.', // TODO - Translation 'ok' => '%s is now disabled', // TODO - Translation @@ -47,6 +48,7 @@ return array( 'no_access' => 'You have no access on %s', // TODO - Translation 'not_enabled' => '%s is not enabled yet', 'not_found' => '%s does not exist', // TODO - Translation + 'removed' => '%s removed', // TODO - Translation ), 'import_export' => array( 'export_no_zip_extension' => 'ZIP extension is not present on your server. Please try to export files one by one.', // TODO - Translation diff --git a/app/i18n/sk/feedback.php b/app/i18n/sk/feedback.php index ed880f1c8..04017c95c 100644 --- a/app/i18n/sk/feedback.php +++ b/app/i18n/sk/feedback.php @@ -36,6 +36,7 @@ return array( ), 'extensions' => array( 'already_enabled' => '%s už je povolené', + 'cannot_remove' => '%s cannot be removed', // TODO - Translation 'disable' => array( 'ko' => '%s sa nepodarilo nainštalovať. Prečítajte si záznamy FreshRSS, ak chcete poznať podrobnosti.', 'ok' => '%s je teraz zakázaný', @@ -47,6 +48,7 @@ return array( 'no_access' => 'Nemáte prístup k %s', 'not_enabled' => '%s nie je povolený', 'not_found' => '%s neexistuje', + 'removed' => '%s removed', // TODO - Translation ), 'import_export' => array( 'export_no_zip_extension' => 'ZIP rozšírenie sa na vašom serveri nenachádza. Prosím, skúste exportovať súbory pojednom.', diff --git a/app/i18n/tr/feedback.php b/app/i18n/tr/feedback.php index c0c71d65a..90b77360b 100644 --- a/app/i18n/tr/feedback.php +++ b/app/i18n/tr/feedback.php @@ -36,6 +36,7 @@ return array( ), 'extensions' => array( 'already_enabled' => '%s zaten aktif', + 'cannot_remove' => '%s cannot be removed', // TODO - Translation 'disable' => array( 'ko' => '%s gösterilemiyor. Detaylar için FreshRSS log kayıtlarını kontrol edin.', 'ok' => '%s pasif', @@ -47,6 +48,7 @@ return array( 'no_access' => '%s de yetkiniz yok', 'not_enabled' => '%s henüz aktif değil', 'not_found' => '%s bulunmamaktadır', + 'removed' => '%s removed', // TODO - Translation ), 'import_export' => array( 'export_no_zip_extension' => 'ZIP eklentisi mevcut sunucunuzda yer almıyor. Lütfen başka dosya formatında dışarı aktarmayı deneyin.', diff --git a/app/i18n/zh-cn/feedback.php b/app/i18n/zh-cn/feedback.php index fc8f46e03..677154ea9 100644 --- a/app/i18n/zh-cn/feedback.php +++ b/app/i18n/zh-cn/feedback.php @@ -36,6 +36,7 @@ return array( ), 'extensions' => array( 'already_enabled' => '%s 已启用', + 'cannot_remove' => '%s cannot be removed', // TODO - Translation 'disable' => array( 'ko' => '禁用 %s 失败。检查 FreshRSS 日志 查看详情。', 'ok' => '%s 现已禁用', @@ -47,6 +48,7 @@ return array( 'no_access' => '你无权访问 %s', 'not_enabled' => '%s 未启用', 'not_found' => '%s 不存在', + 'removed' => '%s removed', // TODO - Translation ), 'import_export' => array( 'export_no_zip_extension' => '服务器未启用 ZIP 扩展。请尝试逐个导出文件。', diff --git a/cli/i18n/I18nData.php b/cli/i18n/I18nData.php index a6d260a8f..2f09a5525 100644 --- a/cli/i18n/I18nData.php +++ b/cli/i18n/I18nData.php @@ -132,6 +132,17 @@ class I18nData { $this->data[$language] = $this->data[static::REFERENCE_LANGUAGE]; } + /** + * Check if the key is known. + * + * @param string $key + * @return bool + */ + public function isKnown($key) { + return array_key_exists($this->getFilenamePrefix($key), $this->data[static::REFERENCE_LANGUAGE]) && + array_key_exists($key, $this->data[static::REFERENCE_LANGUAGE][$this->getFilenamePrefix($key)]); + } + /** * Add a new key to all languages. * @@ -140,8 +151,7 @@ class I18nData { * @throws Exception */ public function addKey($key, $value) { - if (array_key_exists($this->getFilenamePrefix($key), $this->data[static::REFERENCE_LANGUAGE]) && - array_key_exists($key, $this->data[static::REFERENCE_LANGUAGE][$this->getFilenamePrefix($key)])) { + if ($this->isKnown($key)) { throw new Exception('The selected key already exist.'); } @@ -178,8 +188,7 @@ class I18nData { * @throws Exception */ public function removeKey($key) { - if (!array_key_exists($this->getFilenamePrefix($key), $this->data[static::REFERENCE_LANGUAGE]) || - !array_key_exists($key, $this->data[static::REFERENCE_LANGUAGE][$this->getFilenamePrefix($key)])) { + if (!$this->isKnown($key)) { throw new Exception('The selected key does not exist.'); } foreach ($this->getAvailableLanguages() as $language) { diff --git a/cli/manipulate.translation.php b/cli/manipulate.translation.php index c6aa328d9..c1f1132b4 100644 --- a/cli/manipulate.translation.php +++ b/cli/manipulate.translation.php @@ -39,6 +39,19 @@ switch ($options['a']) { exit; } break; + case 'exist': + if (array_key_exists('k', $options)) { + $key = $options['k']; + if ($i18nData->isKnown($key)) { + echo "The '{$key}' key is known.\n\n"; + } else { + echo "The '{$key}' key is unknown.\n\n"; + } + } else { + error('You need to specify the key to check.'); + exit; + } + break; case 'format' : break; case 'ignore' : @@ -85,7 +98,7 @@ DESCRIPTION -a=ACTION select the action to perform. Available actions are add, delete, - format, and ignore. This option is mandatory. + exist, format, and ignore. This option is mandatory. -k=KEY select the key to work on. -v=VAL select the value to set. -l=LANG select the language to work on. @@ -111,7 +124,10 @@ Exemple 6: ignore a key. It adds the key in the ignore file to mark it as transl php %1\$s -a ignore -k my_key -l my_lang Exemple 7: revert ignore a key. It removes the key from the ignore file. - php %1\$s -a ignore -r -k my_key -l my_lang\n\n + php %1\$s -a ignore -r -k my_key -l my_lang + +Exemple 8: check if a key exist. + php %1\$s -a exist -k my_key\n\n HELP; $file = str_replace(__DIR__ . '/', '', __FILE__); echo sprintf($help, $file); -- cgit v1.2.3