From f37131a5bfe97272b2a573d4b961883185a4ba6c Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sat, 19 Oct 2019 00:02:20 +0100 Subject: [PATCH] Removed old Translation Service + Provider Was no longer needed due to only being there to perform language extension for de_informal but now this is done by crowdin instead so it's redundant. Same goes for checking and formatting scripts. Also removed comment advising deletion form settings.php language list since this is now auto-copied to languages anyway. Related to #1261 --- app/Config/app.php | 2 +- app/Providers/TranslationServiceProvider.php | 31 -- app/Translation/Translator.php | 72 ---- resources/lang/ar/settings.php | 5 +- resources/lang/check.php | 114 ------- resources/lang/cs/settings.php | 5 +- resources/lang/de/settings.php | 5 +- resources/lang/de_informal/settings.php | 5 +- resources/lang/en/settings.php | 5 +- resources/lang/es/settings.php | 5 +- resources/lang/es_AR/settings.php | 5 +- resources/lang/format.php | 330 ------------------- resources/lang/fr/settings.php | 5 +- resources/lang/hu/settings.php | 5 +- resources/lang/it/settings.php | 5 +- resources/lang/ja/settings.php | 5 +- resources/lang/ko/settings.php | 5 +- resources/lang/nl/settings.php | 5 +- resources/lang/pl/settings.php | 5 +- resources/lang/pt_BR/settings.php | 5 +- resources/lang/ru/settings.php | 5 +- resources/lang/sk/settings.php | 5 +- resources/lang/sv/settings.php | 5 +- resources/lang/tr/settings.php | 5 +- resources/lang/uk/settings.php | 5 +- resources/lang/zh_CN/settings.php | 5 +- resources/lang/zh_TW/settings.php | 5 +- tests/LanguageTest.php | 17 - 28 files changed, 45 insertions(+), 631 deletions(-) delete mode 100644 app/Providers/TranslationServiceProvider.php delete mode 100644 app/Translation/Translator.php delete mode 100755 resources/lang/check.php delete mode 100755 resources/lang/format.php diff --git a/app/Config/app.php b/app/Config/app.php index 85b892465..f2c90c5bb 100755 --- a/app/Config/app.php +++ b/app/Config/app.php @@ -96,6 +96,7 @@ return [ Illuminate\Redis\RedisServiceProvider::class, Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, Illuminate\Session\SessionServiceProvider::class, + Illuminate\Translation\TranslationServiceProvider::class, Illuminate\Validation\ValidationServiceProvider::class, Illuminate\View\ViewServiceProvider::class, Illuminate\Notifications\NotificationServiceProvider::class, @@ -109,7 +110,6 @@ return [ // BookStack replacement service providers (Extends Laravel) BookStack\Providers\PaginationServiceProvider::class, - BookStack\Providers\TranslationServiceProvider::class, // BookStack custom service providers BookStack\Providers\AuthServiceProvider::class, diff --git a/app/Providers/TranslationServiceProvider.php b/app/Providers/TranslationServiceProvider.php deleted file mode 100644 index 7d51cc73d..000000000 --- a/app/Providers/TranslationServiceProvider.php +++ /dev/null @@ -1,31 +0,0 @@ -registerLoader(); - - $this->app->singleton('translator', function ($app) { - $loader = $app['translation.loader']; - - // When registering the translator component, we'll need to set the default - // locale as well as the fallback locale. So, we'll grab the application - // configuration so we can easily get both of these values from there. - $locale = $app['config']['app.locale']; - - $trans = new Translator($loader, $locale); - - $trans->setFallback($app['config']['app.fallback_locale']); - - return $trans; - }); - } -} diff --git a/app/Translation/Translator.php b/app/Translation/Translator.php deleted file mode 100644 index 032f43ff7..000000000 --- a/app/Translation/Translator.php +++ /dev/null @@ -1,72 +0,0 @@ - 'de', - ]; - - /** - * Get the translation for a given key. - * - * @param string $key - * @param array $replace - * @param string $locale - * @return string|array|null - */ - public function trans($key, array $replace = [], $locale = null) - { - $translation = $this->get($key, $replace, $locale); - - if (is_array($translation)) { - $translation = $this->mergeBackupTranslations($translation, $key, $locale); - } - - return $translation; - } - - /** - * Merge the fallback translations, and base translations if existing, - * into the provided core key => value array of translations content. - * @param array $translationArray - * @param string $key - * @param null $locale - * @return array - */ - protected function mergeBackupTranslations(array $translationArray, string $key, $locale = null) - { - $fallback = $this->get($key, [], $this->fallback); - $baseLocale = $this->getBaseLocale($locale ?? $this->locale); - $baseTranslations = $baseLocale ? $this->get($key, [], $baseLocale) : []; - - return array_replace_recursive($fallback, $baseTranslations, $translationArray); - } - - /** - * Get the array of locales to be checked. - * - * @param string|null $locale - * @return array - */ - protected function localeArray($locale) - { - $primaryLocale = $locale ?: $this->locale; - return array_filter([$primaryLocale, $this->getBaseLocale($primaryLocale), $this->fallback]); - } - - /** - * Get the locale to extend for the given locale. - * - * @param string $locale - * @return string|null - */ - protected function getBaseLocale($locale) - { - return $this->baseLocaleMap[$locale] ?? null; - } -} diff --git a/resources/lang/ar/settings.php b/resources/lang/ar/settings.php index d886bc54d..d867e30b5 100755 --- a/resources/lang/ar/settings.php +++ b/resources/lang/ar/settings.php @@ -135,9 +135,8 @@ return [ 'users_social_connected' => 'تم ربط حساب :socialAccount بملفك بنجاح.', 'users_social_disconnected' => 'تم فصل حساب :socialAccount من ملفك بنجاح.', - //! Since these labels are already localized this array does not need to be - //! translated in the language-specific files. - //! DELETE BELOW IF COPIED FROM EN + //! If editing translations files directly please ignore this in all + //! languages apart from en. Content will be auto-copied from en. //!//////////////////////////////// 'language_select' => [ 'en' => 'English', diff --git a/resources/lang/check.php b/resources/lang/check.php deleted file mode 100755 index 92a7b1eaf..000000000 --- a/resources/lang/check.php +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/env php - $enStr) { - if (strpos($enKey, 'settings.language_select.') === 0) { - unset($langContent[$enKey]); - continue; - } - if (!isset($langContent[$enKey])) { - $missingLangStrings[$enKey] = $enStr; - continue; - } - unset($langContent[$enKey]); -} - -if (count($missingLangStrings) > 0) { - info("\n========================"); - info("Missing language content"); - info("========================"); - outputFlatArray($missingLangStrings, $lang); -} - -if (count($langContent) > 0) { - info("\n=========================="); - info("Redundant language content"); - info("=========================="); - outputFlatArray($langContent, $lang); -} - -function outputFlatArray($arr, $lang) { - $grouped = []; - foreach ($arr as $key => $val) { - $explodedKey = explode('.', $key); - $group = $explodedKey[0]; - $path = implode('.', array_slice($explodedKey, 1)); - if (!isset($grouped[$group])) $grouped[$group] = []; - $grouped[$group][$path] = $val; - } - foreach ($grouped as $filename => $arr) { - echo "\e[36m" . $lang . '/' . $filename . ".php\e[0m\n"; - echo json_encode($arr, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE) . "\n"; - } -} - -function formatLang($lang) { - $langParts = explode('_', strtoupper($lang)); - $langParts[0] = strtolower($langParts[0]); - return implode('_', $langParts); -} - -function loadLang(string $lang) { - $dir = __DIR__ . "/{$lang}"; - if (!file_exists($dir)) { - errorOut("Expected directory '{$dir}' does not exist"); - } - $files = scandir($dir); - $data = []; - foreach ($files as $file) { - if (substr($file, -4) !== '.php') continue; - $fileData = include ($dir . '/' . $file); - $name = substr($file, 0, -4); - $data[$name] = $fileData; - } - return flattenArray($data); -} - -function flattenArray(array $arr) { - $data = []; - foreach ($arr as $key => $arrItem) { - if (!is_array($arrItem)) { - $data[$key] = $arrItem; - continue; - } - - $toUse = flattenArray($arrItem); - foreach ($toUse as $innerKey => $item) { - $data[$key . '.' . $innerKey] = $item; - } - } - return $data; -} - -function info($text) { - echo "\e[34m" . $text . "\e[0m\n"; -} - -function errorOut($text) { - echo "\e[31m" . $text . "\e[0m\n"; - exit(1); -} \ No newline at end of file diff --git a/resources/lang/cs/settings.php b/resources/lang/cs/settings.php index 7a29bd477..bb6e6be09 100644 --- a/resources/lang/cs/settings.php +++ b/resources/lang/cs/settings.php @@ -135,9 +135,8 @@ return [ 'users_social_connected' => 'Účet :socialAccount byl úspěšně přidružen k vašemu profilu.', 'users_social_disconnected' => 'Přidružení účtu :socialAccount k vašemu profilu bylo úspěšně zrušeno.', - //! Since these labels are already localized this array does not need to be - //! translated in the language-specific files. - //! DELETE BELOW IF COPIED FROM EN + //! If editing translations files directly please ignore this in all + //! languages apart from en. Content will be auto-copied from en. //!//////////////////////////////// 'language_select' => [ 'en' => 'English', diff --git a/resources/lang/de/settings.php b/resources/lang/de/settings.php index 244b9af07..fa7df43f8 100644 --- a/resources/lang/de/settings.php +++ b/resources/lang/de/settings.php @@ -138,9 +138,8 @@ Hinweis: Benutzer können ihre E-Mail Adresse nach erfolgreicher Registrierung 'users_social_connected' => ':socialAccount-Konto wurde erfolgreich mit dem Profil verknüpft.', 'users_social_disconnected' => ':socialAccount-Konto wurde erfolgreich vom Profil gelöst.', - //! Since these labels are already localized this array does not need to be - //! translated in the language-specific files. - //! DELETE BELOW IF COPIED FROM EN + //! If editing translations files directly please ignore this in all + //! languages apart from en. Content will be auto-copied from en. //!//////////////////////////////// 'language_select' => [ 'en' => 'English', diff --git a/resources/lang/de_informal/settings.php b/resources/lang/de_informal/settings.php index aecf5c977..ed8d8a11f 100644 --- a/resources/lang/de_informal/settings.php +++ b/resources/lang/de_informal/settings.php @@ -138,9 +138,8 @@ Hinweis: Benutzer können ihre E-Mail Adresse nach erfolgreicher Registrierung 'users_social_connected' => ':socialAccount-Konto wurde erfolgreich mit dem Profil verknüpft.', 'users_social_disconnected' => ':socialAccount-Konto wurde erfolgreich vom Profil gelöst.', - //! Since these labels are already localized this array does not need to be - //! translated in the language-specific files. - //! DELETE BELOW IF COPIED FROM EN + //! If editing translations files directly please ignore this in all + //! languages apart from en. Content will be auto-copied from en. //!//////////////////////////////// 'language_select' => [ 'en' => 'English', diff --git a/resources/lang/en/settings.php b/resources/lang/en/settings.php index 14e5ae3b0..63b6f6d43 100755 --- a/resources/lang/en/settings.php +++ b/resources/lang/en/settings.php @@ -135,9 +135,8 @@ return [ 'users_social_connected' => ':socialAccount account was successfully attached to your profile.', 'users_social_disconnected' => ':socialAccount account was successfully disconnected from your profile.', - //! Since these labels are already localized this array does not need to be - //! translated in the language-specific files. - //! DELETE BELOW IF COPIED FROM EN + //! If editing translations files directly please ignore this in all + //! languages apart from en. Content will be auto-copied from en. //!//////////////////////////////// 'language_select' => [ 'en' => 'English', diff --git a/resources/lang/es/settings.php b/resources/lang/es/settings.php index 1a3329b94..f448bdd22 100644 --- a/resources/lang/es/settings.php +++ b/resources/lang/es/settings.php @@ -135,9 +135,8 @@ return [ 'users_social_connected' => 'La cuenta :socialAccount ha sido añadida éxitosamente a su perfil.', 'users_social_disconnected' => 'La cuenta :socialAccount ha sido desconectada éxitosamente de su perfil.', - //! Since these labels are already localized this array does not need to be - //! translated in the language-specific files. - //! DELETE BELOW IF COPIED FROM EN + //! If editing translations files directly please ignore this in all + //! languages apart from en. Content will be auto-copied from en. //!//////////////////////////////// 'language_select' => [ 'en' => 'English', diff --git a/resources/lang/es_AR/settings.php b/resources/lang/es_AR/settings.php index 3b3698574..e9aad7128 100644 --- a/resources/lang/es_AR/settings.php +++ b/resources/lang/es_AR/settings.php @@ -136,9 +136,8 @@ return [ 'users_social_connected' => 'La cuenta :socialAccount ha sido exitosamente añadida a su perfil.', 'users_social_disconnected' => 'La cuenta :socialAccount ha sido desconectada exitosamente de su perfil.', - //! Since these labels are already localized this array does not need to be - //! translated in the language-specific files. - //! DELETE BELOW IF COPIED FROM EN + //! If editing translations files directly please ignore this in all + //! languages apart from en. Content will be auto-copied from en. //!//////////////////////////////// 'language_select' => [ 'en' => 'English', diff --git a/resources/lang/format.php b/resources/lang/format.php deleted file mode 100755 index 45d0b4842..000000000 --- a/resources/lang/format.php +++ /dev/null @@ -1,330 +0,0 @@ -#!/usr/bin/env php - $line) { - $trimLine = trim($line); - if ($mode === 'header') { - $formatted[$index] = $line; - if (str_replace(' ', '', $trimLine) === 'return[') $mode = 'body'; - } - - if ($mode === 'body') { - $matches = []; - $arrayEndMatch = preg_match('/]\s*,\s*$/', $trimLine); - - if ($skipArray) { - if ($arrayEndMatch) $skipArray = false; - continue; - } - - // Comment to ignore - if (strpos($trimLine, '//!') === 0) { - $formatted[$index] = ""; - continue; - } - - // Comment - if (strpos($trimLine, '//') === 0) { - $formatted[$index] = "\t" . $trimLine; - continue; - } - - // Arrays - $arrayStartMatch = preg_match('/^\'(.*)\'\s+?=>\s+?\[(\],)?\s*?$/', $trimLine, $matches); - - $indent = count($arrayKeys) + 1; - if ($arrayStartMatch === 1) { - if ($fileName === 'settings' && $matches[1] === 'language_select') { - $skipArray = true; - continue; - } - $arrayKeys[] = $matches[1]; - $formatted[$index] = str_repeat(" ", $indent * 4) . str_pad("'{$matches[1]}'", $longestKeyLength) . "=> ["; - if ($arrayEndMatch !== 1) continue; - } - if ($arrayEndMatch === 1) { - unsetArrayByKeys($langContent, $arrayKeys); - array_pop($arrayKeys); - if (isset($formatted[$index])) { - $formatted[$index] .= '],'; - } else { - $formatted[$index] = str_repeat(" ", ($indent-1) * 4) . "],"; - } - continue; - } - - // Translation - $translationMatch = preg_match('/^\'(.*)\'\s+?=>\s+?[\'"](.*)?[\'"].+?$/', $trimLine, $matches); - if ($translationMatch === 1) { - $key = $matches[1]; - $keys = array_merge($arrayKeys, [$key]); - $langVal = getTranslationByKeys($langContent, $keys); - if (empty($langVal)) continue; - - $keyPad = $longestKeyLength; - if (count($arrayKeys) === 0) { - unset($langContent[$key]); - } else { - $keyPad = calculateKeyPadding(getTranslationByKeys($enContent, $arrayKeys)); - } - - $formatted[$index] = formatTranslationLine($key, $langVal, $indent, $keyPad); - continue; - } - } - - } - - // Fill missing lines - $arraySize = max(array_keys($formatted)); - $formatted = array_replace(array_fill(0, $arraySize, ''), $formatted); - - // Add remaining translations - $langContent = array_filter($langContent, function($item) { - return !is_null($item) && !empty($item); - }); - if (count($langContent) > 0) { - $formatted[] = ''; - $formatted[] = "\t// Unmatched"; - } - foreach ($langContent as $key => $value) { - if (is_array($value)) { - $formatted[] = formatTranslationArray($key, $value); - } else { - $formatted[] = formatTranslationLine($key, $value); - } - } - - // Add end line - $formatted[] = '];'; - return implode("\n", $formatted); -} - -/** - * Format a translation line. - * @param string $key - * @param string $value - * @param int $indent - * @param int $keyPad - * @return string - */ -function formatTranslationLine(string $key, string $value, int $indent = 1, int $keyPad = 1) : string { - $start = str_repeat(" ", $indent * 4) . str_pad("'{$key}'", $keyPad, ' '); - if (strpos($value, "\n") !== false) { - $escapedValue = '"' . str_replace("\n", '\n', $value) . '"'; - $escapedValue = '"' . str_replace('"', '\"', $escapedValue) . '"'; - } else { - $escapedValue = "'" . str_replace("'", "\\'", $value) . "'"; - } - return "{$start} => {$escapedValue},"; -} - -/** - * Find the longest key in the array and provide the length - * for all keys to be used when printed. - * @param array $array - * @return int - */ -function calculateKeyPadding(array $array) : int { - $top = 0; - foreach ($array as $key => $value) { - $keyLen = strlen($key); - $top = max($top, $keyLen); - } - return min(35, $top + 2); -} - -/** - * Format an translation array with the given key. - * Simply prints as an old-school php array. - * Used as a last-resort backup to save unused translations. - * @param string $key - * @param array $array - * @return string - */ -function formatTranslationArray(string $key, array $array) : string { - $arrayPHP = var_export($array, true); - return " '{$key}' => {$arrayPHP},"; -} - -/** - * Find a string translation value within a multi-dimensional array - * by traversing the given array of keys. - * @param array $translations - * @param array $keys - * @return string|array - */ -function getTranslationByKeys(array $translations, array $keys) { - $val = $translations; - foreach ($keys as $key) { - $val = $val[$key] ?? ''; - if ($val === '') return ''; - } - return $val; -} - -/** - * Unset an inner item of a multi-dimensional array by - * traversing the given array of keys. - * @param array $input - * @param array $keys - */ -function unsetArrayByKeys(array &$input, array $keys) { - $val = &$input; - $lastIndex = count($keys) - 1; - foreach ($keys as $index => &$key) { - if ($index === $lastIndex && is_array($val)) { - unset($val[$key]); - } - if (!is_array($val)) return; - $val = &$val[$key] ?? []; - } -} - -/** - * Write the given content to a translation file. - * @param string $lang - * @param string $fileName - * @param string $content - */ -function writeLangFile(string $lang, string $fileName, string $content) { - $path = __DIR__ . "/{$lang}/{$fileName}.php"; - if (!file_exists($path)) { - errorOut("Expected translation file '{$path}' does not exist"); - } - file_put_contents($path, $content); -} - -/** - * Load the contents of a language file as an array of text lines. - * @param string $lang - * @param string $fileName - * @return array - */ -function loadLangFileLines(string $lang, string $fileName) : array { - $path = __DIR__ . "/{$lang}/{$fileName}.php"; - if (!file_exists($path)) { - errorOut("Expected translation file '{$path}' does not exist"); - } - $lines = explode("\n", file_get_contents($path)); - return array_map(function($line) { - return trim($line, "\r"); - }, $lines); -} - -/** - * Load the contents of a language file - * @param string $lang - * @param string $fileName - * @return array - */ -function loadLang(string $lang, string $fileName) : array { - $path = __DIR__ . "/{$lang}/{$fileName}.php"; - if (!file_exists($path)) { - errorOut("Expected translation file '{$path}' does not exist"); - } - - $fileData = include($path); - return $fileData; -} - -/** - * Fetch an array containing the names of all translation files without the extension. - * @return array - */ -function getTranslationFileNames() : array { - $dir = __DIR__ . "/en"; - if (!file_exists($dir)) { - errorOut("Expected directory '{$dir}' does not exist"); - } - $files = scandir($dir); - $fileNames = []; - foreach ($files as $file) { - if (substr($file, -4) === '.php') { - $fileNames[] = substr($file, 0, strlen($file) - 4); - } - } - return $fileNames; -} - -/** - * Format a locale to follow the lowercase_UPERCASE standard - * @param string $lang - * @return string - */ -function formatLocale(string $lang) : string { - $langParts = explode('_', strtoupper($lang)); - $langParts[0] = strtolower($langParts[0]); - return implode('_', $langParts); -} - -/** - * Dump a variable then die. - * @param $content - */ -function dd($content) { - print_r($content); - exit(1); -} - -/** - * Log out some information text in blue - * @param $text - */ -function info($text) { - echo "\e[34m" . $text . "\e[0m\n"; -} - -/** - * Log out an error in red and exit. - * @param $text - */ -function errorOut($text) { - echo "\e[31m" . $text . "\e[0m\n"; - exit(1); -} \ No newline at end of file diff --git a/resources/lang/fr/settings.php b/resources/lang/fr/settings.php index aca9dd04e..fc25fb22c 100644 --- a/resources/lang/fr/settings.php +++ b/resources/lang/fr/settings.php @@ -135,9 +135,8 @@ return [ 'users_social_connected' => 'Votre compte :socialAccount a été ajouté avec succès.', 'users_social_disconnected' => 'Votre compte :socialAccount a été déconnecté avec succès', - //! Since these labels are already localized this array does not need to be - //! translated in the language-specific files. - //! DELETE BELOW IF COPIED FROM EN + //! If editing translations files directly please ignore this in all + //! languages apart from en. Content will be auto-copied from en. //!//////////////////////////////// 'language_select' => [ 'en' => 'English', diff --git a/resources/lang/hu/settings.php b/resources/lang/hu/settings.php index 83a75dfb3..058784dc7 100644 --- a/resources/lang/hu/settings.php +++ b/resources/lang/hu/settings.php @@ -135,9 +135,8 @@ return [ 'users_social_connected' => ':socialAccount fiók sikeresen csatlakoztatva a profilhoz.', 'users_social_disconnected' => ':socialAccount fiók sikeresen lecsatlakoztatva a profilról.', - //! Since these labels are already localized this array does not need to be - //! translated in the language-specific files. - //! DELETE BELOW IF COPIED FROM EN + //! If editing translations files directly please ignore this in all + //! languages apart from en. Content will be auto-copied from en. //!//////////////////////////////// 'language_select' => [ 'en' => 'English', diff --git a/resources/lang/it/settings.php b/resources/lang/it/settings.php index e6a49f1f5..fe3127965 100755 --- a/resources/lang/it/settings.php +++ b/resources/lang/it/settings.php @@ -135,9 +135,8 @@ return [ 'users_social_connected' => 'L\'account :socialAccount è stato connesso correttamente al tuo profilo.', 'users_social_disconnected' => 'L\'account :socialAccount è stato disconnesso correttamente dal tuo profilo.', - //! Since these labels are already localized this array does not need to be - //! translated in the language-specific files. - //! DELETE BELOW IF COPIED FROM EN + //! If editing translations files directly please ignore this in all + //! languages apart from en. Content will be auto-copied from en. //!//////////////////////////////// 'language_select' => [ 'en' => 'English', diff --git a/resources/lang/ja/settings.php b/resources/lang/ja/settings.php index d848247f6..34eb469e9 100644 --- a/resources/lang/ja/settings.php +++ b/resources/lang/ja/settings.php @@ -135,9 +135,8 @@ return [ 'users_social_connected' => '「:socialAccount」がプロフィールに接続されました。', 'users_social_disconnected' => '「:socialAccount」がプロフィールから接続解除されました。', - //! Since these labels are already localized this array does not need to be - //! translated in the language-specific files. - //! DELETE BELOW IF COPIED FROM EN + //! If editing translations files directly please ignore this in all + //! languages apart from en. Content will be auto-copied from en. //!//////////////////////////////// 'language_select' => [ 'en' => 'English', diff --git a/resources/lang/ko/settings.php b/resources/lang/ko/settings.php index 588ae9958..346e7f6a8 100755 --- a/resources/lang/ko/settings.php +++ b/resources/lang/ko/settings.php @@ -135,9 +135,8 @@ return [ 'users_social_connected' => ':socialAccount 계정이 당신의 프로필에 연결되었습니다.', 'users_social_disconnected' => ':socialAccount 계정이 당신의 프로필에서 연결해제되었습니다.', - //! Since these labels are already localized this array does not need to be - //! translated in the language-specific files. - //! DELETE BELOW IF COPIED FROM EN + //! If editing translations files directly please ignore this in all + //! languages apart from en. Content will be auto-copied from en. //!//////////////////////////////// 'language_select' => [ 'en' => 'English', diff --git a/resources/lang/nl/settings.php b/resources/lang/nl/settings.php index 11f52175b..dc5521797 100644 --- a/resources/lang/nl/settings.php +++ b/resources/lang/nl/settings.php @@ -135,9 +135,8 @@ return [ 'users_social_connected' => ':socialAccount account is succesvol aan je profiel gekoppeld.', 'users_social_disconnected' => ':socialAccount account is succesvol ontkoppeld van je profiel.', - //! Since these labels are already localized this array does not need to be - //! translated in the language-specific files. - //! DELETE BELOW IF COPIED FROM EN + //! If editing translations files directly please ignore this in all + //! languages apart from en. Content will be auto-copied from en. //!//////////////////////////////// 'language_select' => [ 'en' => 'English', diff --git a/resources/lang/pl/settings.php b/resources/lang/pl/settings.php index 49a537b6c..2c17657e4 100644 --- a/resources/lang/pl/settings.php +++ b/resources/lang/pl/settings.php @@ -135,9 +135,8 @@ return [ 'users_social_connected' => ':socialAccount zostało dodane do Twojego profilu.', 'users_social_disconnected' => ':socialAccount zostało odłączone od Twojego profilu.', - //! Since these labels are already localized this array does not need to be - //! translated in the language-specific files. - //! DELETE BELOW IF COPIED FROM EN + //! If editing translations files directly please ignore this in all + //! languages apart from en. Content will be auto-copied from en. //!//////////////////////////////// 'language_select' => [ 'en' => 'English', diff --git a/resources/lang/pt_BR/settings.php b/resources/lang/pt_BR/settings.php index c819a6c49..03283d752 100644 --- a/resources/lang/pt_BR/settings.php +++ b/resources/lang/pt_BR/settings.php @@ -135,9 +135,8 @@ return [ 'users_social_connected' => 'Conta :socialAccount foi conectada com sucesso ao seu perfil.', 'users_social_disconnected' => 'Conta :socialAccount foi desconectada com sucesso de seu perfil.', - //! Since these labels are already localized this array does not need to be - //! translated in the language-specific files. - //! DELETE BELOW IF COPIED FROM EN + //! If editing translations files directly please ignore this in all + //! languages apart from en. Content will be auto-copied from en. //!//////////////////////////////// 'language_select' => [ 'en' => 'English', diff --git a/resources/lang/ru/settings.php b/resources/lang/ru/settings.php index 505c92a82..f268c7e4c 100755 --- a/resources/lang/ru/settings.php +++ b/resources/lang/ru/settings.php @@ -135,9 +135,8 @@ return [ 'users_social_connected' => ':socialAccount аккаунт упешно подключен к вашему профилю.', 'users_social_disconnected' => ':socialAccount аккаунт успешно отключен от вашего профиля.', - //! Since these labels are already localized this array does not need to be - //! translated in the language-specific files. - //! DELETE BELOW IF COPIED FROM EN + //! If editing translations files directly please ignore this in all + //! languages apart from en. Content will be auto-copied from en. //!//////////////////////////////// 'language_select' => [ 'en' => 'English', diff --git a/resources/lang/sk/settings.php b/resources/lang/sk/settings.php index 304c1c0f1..dc1e06bc5 100644 --- a/resources/lang/sk/settings.php +++ b/resources/lang/sk/settings.php @@ -135,9 +135,8 @@ return [ 'users_social_connected' => ':socialAccount účet bol úspešne pripojený k Vášmu profilu.', 'users_social_disconnected' => ':socialAccount účet bol úspešne odpojený od Vášho profilu.', - //! Since these labels are already localized this array does not need to be - //! translated in the language-specific files. - //! DELETE BELOW IF COPIED FROM EN + //! If editing translations files directly please ignore this in all + //! languages apart from en. Content will be auto-copied from en. //!//////////////////////////////// 'language_select' => [ 'en' => 'English', diff --git a/resources/lang/sv/settings.php b/resources/lang/sv/settings.php index 12e345ee0..c848ac651 100644 --- a/resources/lang/sv/settings.php +++ b/resources/lang/sv/settings.php @@ -135,9 +135,8 @@ return [ 'users_social_connected' => ':socialAccount har kopplats till ditt konto.', 'users_social_disconnected' => ':socialAccount har kopplats bort från ditt konto.', - //! Since these labels are already localized this array does not need to be - //! translated in the language-specific files. - //! DELETE BELOW IF COPIED FROM EN + //! If editing translations files directly please ignore this in all + //! languages apart from en. Content will be auto-copied from en. //!//////////////////////////////// 'language_select' => [ 'en' => 'English', diff --git a/resources/lang/tr/settings.php b/resources/lang/tr/settings.php index 041180ac6..bb35fe323 100755 --- a/resources/lang/tr/settings.php +++ b/resources/lang/tr/settings.php @@ -135,9 +135,8 @@ return [ 'users_social_connected' => ':socialAccount hesabı profilinize başarıyla bağlandı.', 'users_social_disconnected' => ':socialAccount hesabınızın profilinizle ilişiği başarıyla kesildi.', - //! Since these labels are already localized this array does not need to be - //! translated in the language-specific files. - //! DELETE BELOW IF COPIED FROM EN + //! If editing translations files directly please ignore this in all + //! languages apart from en. Content will be auto-copied from en. //!//////////////////////////////// 'language_select' => [ 'en' => 'English', diff --git a/resources/lang/uk/settings.php b/resources/lang/uk/settings.php index 324663b42..d11b6393c 100644 --- a/resources/lang/uk/settings.php +++ b/resources/lang/uk/settings.php @@ -135,9 +135,8 @@ return [ 'users_social_connected' => 'Обліковий запис :socialAccount успішно додано до вашого профілю.', 'users_social_disconnected' => 'Обліковий запис :socialAccount був успішно відключений від вашого профілю.', - //! Since these labels are already localized this array does not need to be - //! translated in the language-specific files. - //! DELETE BELOW IF COPIED FROM EN + //! If editing translations files directly please ignore this in all + //! languages apart from en. Content will be auto-copied from en. //!//////////////////////////////// 'language_select' => [ 'en' => 'English', diff --git a/resources/lang/zh_CN/settings.php b/resources/lang/zh_CN/settings.php index da6c6e64f..bc489376c 100755 --- a/resources/lang/zh_CN/settings.php +++ b/resources/lang/zh_CN/settings.php @@ -135,9 +135,8 @@ return [ 'users_social_connected' => ':socialAccount 账户已经成功绑定到您的资料。', 'users_social_disconnected' => ':socialAccount 账户已经成功解除绑定。', - //! Since these labels are already localized this array does not need to be - //! translated in the language-specific files. - //! DELETE BELOW IF COPIED FROM EN + //! If editing translations files directly please ignore this in all + //! languages apart from en. Content will be auto-copied from en. //!//////////////////////////////// 'language_select' => [ 'en' => 'English', diff --git a/resources/lang/zh_TW/settings.php b/resources/lang/zh_TW/settings.php index 1c2bb69f7..0ad899a27 100644 --- a/resources/lang/zh_TW/settings.php +++ b/resources/lang/zh_TW/settings.php @@ -135,9 +135,8 @@ return [ 'users_social_connected' => ':socialAccount 帳號已經成功連結到您的資料。', 'users_social_disconnected' => ':socialAccount 帳號已經成功解除連結。', - //! Since these labels are already localized this array does not need to be - //! translated in the language-specific files. - //! DELETE BELOW IF COPIED FROM EN + //! If editing translations files directly please ignore this in all + //! languages apart from en. Content will be auto-copied from en. //!//////////////////////////////// 'language_select' => [ 'en' => 'English', diff --git a/tests/LanguageTest.php b/tests/LanguageTest.php index c8bc44451..cd68756ae 100644 --- a/tests/LanguageTest.php +++ b/tests/LanguageTest.php @@ -66,21 +66,4 @@ class LanguageTest extends TestCase $this->assertTrue(config('app.rtl'), "App RTL config should have been set to true by middleware"); } - public function test_de_informal_falls_base_to_de() - { - // Base de back value - $deBack = trans()->get('common.cancel', [], 'de', false); - $this->assertEquals('Abbrechen', $deBack); - // Ensure de_informal has no value set - $this->assertEquals('common.cancel', trans()->get('common.cancel', [], 'de_informal', false)); - // Ensure standard trans falls back to de - $this->assertEquals($deBack, trans('common.cancel', [], 'de_informal')); - // Ensure de_informal gets its own values where set - $deEmailActionHelp = trans()->get('common.email_action_help', [], 'de', false); - $enEmailActionHelp = trans()->get('common.email_action_help', [], 'en', false); - $deInformalEmailActionHelp = trans()->get('common.email_action_help', [], 'de_informal', false); - $this->assertNotEquals($deEmailActionHelp, $deInformalEmailActionHelp); - $this->assertNotEquals($enEmailActionHelp, $deInformalEmailActionHelp); - } - } \ No newline at end of file