diff --git a/modules/oe_whitelabel_helper/src/EuropeanUnionLanguages.php b/modules/oe_whitelabel_helper/src/EuropeanUnionLanguages.php deleted file mode 100644 index 9ac60d585..000000000 --- a/modules/oe_whitelabel_helper/src/EuropeanUnionLanguages.php +++ /dev/null @@ -1,120 +0,0 @@ - ['Bulgarian', 'български', 'bg'], - 'cs' => ['Czech', 'čeština', 'cs'], - 'da' => ['Danish', 'dansk', 'da'], - 'de' => ['German', 'Deutsch', 'de'], - 'et' => ['Estonian', 'eesti', 'et'], - 'el' => ['Greek', 'ελληνικά', 'el'], - 'en' => ['English', 'English', 'en'], - 'es' => ['Spanish', 'español', 'es'], - 'fr' => ['French', 'français', 'fr'], - 'ga' => ['Irish', 'Gaeilge', 'ga'], - 'hr' => ['Croatian', 'hrvatski', 'hr'], - 'it' => ['Italian', 'italiano', 'it'], - 'lt' => ['Lithuanian', 'lietuvių', 'lt'], - 'lv' => ['Latvian', 'latviešu', 'lv'], - 'hu' => ['Hungarian', 'magyar', 'hu'], - 'mt' => ['Maltese', 'Malti', 'mt'], - 'nl' => ['Dutch', 'Nederlands', 'nl'], - 'pl' => ['Polish', 'polski', 'pl'], - 'pt-pt' => ['Portuguese', 'português', 'pt'], - 'ro' => ['Romanian', 'română', 'ro'], - 'sk' => ['Slovak', 'slovenčina', 'sk'], - 'sl' => ['Slovenian', 'slovenščina', 'sl'], - 'fi' => ['Finnish', 'suomi', 'fi'], - 'sv' => ['Swedish', 'svenska', 'sv'], - ]; - - /** - * Returns a list of language data. - * - * This is the data that is expected to be returned by the overridden language - * manager as supplied by the OpenEuropa Multilingual module. - * - * @return array - * An array with language codes as keys, and English and native language - * names as values. - */ - public static function getLanguageList(): array { - return self::$languages; - } - - /** - * Assert whether the given language is a European Union one. - * - * @param string $language_code - * The language code as defined by the W3C language tags document. - * - * @return bool - * Whereas the given language is a European Union one. - */ - public static function hasLanguage(string $language_code): bool { - return isset(self::$languages[$language_code]); - } - - /** - * Get the language name in English given its W3C code. - * - * @param string $language_code - * The language code as defined by the W3C language tags document. - * - * @return string - * The language name in English if any, an empty string otherwise. - */ - public static function getEnglishLanguageName(string $language_code): string { - return self::$languages[$language_code][0] ?? ''; - } - - /** - * Get the native language name given its W3C code. - * - * @param string $language_code - * The language code as defined by the W3C language tags document. - * - * @return string - * The native language name if any, an empty string otherwise. - */ - public static function getNativeLanguageName(string $language_code): string { - return self::$languages[$language_code][1] ?? ''; - } - - /** - * Get the internal language code given its W3C code. - * - * Internal language codes may differ from the standard ones. - * - * @param string $language_code - * The language code as defined by the W3C language tags document. - * - * @return string - * The internal language code if any, an empty string otherwise. - */ - public static function getInternalLanguageCode(string $language_code): string { - return self::$languages[$language_code][2] ?? ''; - } - -} diff --git a/modules/oe_whitelabel_helper/src/TwigExtension/TwigExtension.php b/modules/oe_whitelabel_helper/src/TwigExtension/TwigExtension.php index 944b17e5f..e66782517 100644 --- a/modules/oe_whitelabel_helper/src/TwigExtension/TwigExtension.php +++ b/modules/oe_whitelabel_helper/src/TwigExtension/TwigExtension.php @@ -6,7 +6,6 @@ use Drupal\Core\Cache\CacheableDependencyInterface; use Drupal\Core\StringTranslation\PluralTranslatableMarkup; -use Drupal\oe_whitelabel_helper\EuropeanUnionLanguages; use Drupal\Core\Url; use Twig\Extension\AbstractExtension; use Twig\TwigFilter; @@ -37,7 +36,6 @@ public function __construct(CacheableDependencyInterface $plugin_manager_block) public function getFilters(): array { return [ new TwigFilter('bcl_timeago', [$this, 'bclTimeAgo']), - new TwigFilter('to_internal_language_id', [$this, 'toInternalLanguageId']), ]; } @@ -184,21 +182,4 @@ public function bclBlock(string $id, array $configuration = []): array { return $block_plugin->build(); } - /** - * Get an internal language ID given its code. - * - * @param string $language_code - * The language code as defined by the W3C language tags document. - * - * @return string - * The internal language ID, or the given language code if none found. - */ - public function toInternalLanguageId(string $language_code): string { - if (EuropeanUnionLanguages::hasLanguage($language_code)) { - return EuropeanUnionLanguages::getInternalLanguageCode($language_code); - } - - return $language_code; - } - } diff --git a/modules/oe_whitelabel_multilingual/oe_whitelabel_multilingual.module b/modules/oe_whitelabel_multilingual/oe_whitelabel_multilingual.module index 1dc9264e1..85fdf74f7 100755 --- a/modules/oe_whitelabel_multilingual/oe_whitelabel_multilingual.module +++ b/modules/oe_whitelabel_multilingual/oe_whitelabel_multilingual.module @@ -8,7 +8,7 @@ declare(strict_types = 1); use Drupal\Component\Utility\Html; -use Drupal\oe_whitelabel_helper\EuropeanUnionLanguages; +use Drupal\oe_bootstrap_theme_helper\EuropeanUnionLanguages; /** * Implements hook_preprocess_links(). diff --git a/oe_whitelabel.theme b/oe_whitelabel.theme index d6ecce13b..2e9eb13a6 100644 --- a/oe_whitelabel.theme +++ b/oe_whitelabel.theme @@ -9,8 +9,8 @@ declare(strict_types = 1); use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Url; +use Drupal\oe_bootstrap_theme_helper\EuropeanUnionLanguages; use Drupal\oe_whitelabel\DocumentMediaWrapper; -use Drupal\oe_whitelabel_helper\EuropeanUnionLanguages; // Include all files from the includes directory. $includes_path = __DIR__ . '/includes/*.inc'; @@ -118,7 +118,7 @@ function oe_whitelabel_preprocess_page(&$variables) { } // Provide correct icon for non-eu languages. $language_code = \Drupal::languageManager()->getCurrentLanguage()->getId(); - if (!EuropeanUnionLanguages::hasLanguage($language_code)) { + if (!EuropeanUnionLanguage::hasLanguage($language_code)) { if ($language_code === 'nb') { // Set correct icon for Norwegian language. $variables['current_language_id'] = 'no';