瀏覽代碼

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
Alexis Degrugillier 5 年之前
父節點
當前提交
8c4d71da2e

+ 8 - 0
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 ##
 ###########

+ 1 - 1
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);
 			}
 		}

+ 2 - 0
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ů <a href="%s">zkontrolujte logy FreshRSS</a>.',
 			'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.',

+ 2 - 0
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 <a href="%s">prüfen Sie die FreshRSS-Protokolle</a>.',
 			'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.',

+ 2 - 0
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. <a href="%s">Check FreshRSS logs</a> 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.',

+ 2 - 0
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. <a href="%s">Revisa el registro de FreshRSS</a> 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.',

+ 2 - 0
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. <a href="%s">Consulter les logs de FreshRSS</a> 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.',

+ 2 - 0
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. <a href="%s">Check FreshRSS logs</a> 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 אינה מותקנת על השרת.',

+ 2 - 0
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. <a href="%s">Verifica i logs</a> 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.',

+ 2 - 0
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 확장 기능을 비활성화 할 수 없습니다. 자세한 내용은 <a href="%s">FreshRSS 로그</a>를 참고하세요.',
 			'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 확장 기능을 서버에서 찾을 수 없습니다. 파일을 하나씩 내보내세요.',

+ 2 - 0
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. <a href="%s">Controleer FreshRSS log bestanden</a> 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.',

+ 2 - 0
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. <a href="%s">Consultatz los jornals d’audit de FreshRSS logs</a> 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.',

+ 2 - 0
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. <a href="%s">verifique os logs do FreshRSS</a> 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.',

+ 2 - 0
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. <a href="%s">Check FreshRSS logs</a> 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

+ 2 - 0
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ť. <a href="%s">Prečítajte si záznamy FreshRSS</a>, 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.',

+ 2 - 0
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 <a href="%s">FreshRSS log kayıtlarını</a> 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.',

+ 2 - 0
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 失败。<a href="%s">检查 FreshRSS 日志</a> 查看详情。',
 			'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 扩展。请尝试逐个导出文件。',

+ 13 - 4
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) {

+ 18 - 2
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);