diff options
Diffstat (limited to 'core/helpers')
-rw-r--r-- | core/helpers/core_menu.php | 6 | ||||
-rw-r--r-- | core/helpers/locale.php | 214 |
2 files changed, 219 insertions, 1 deletions
diff --git a/core/helpers/core_menu.php b/core/helpers/core_menu.php index bb87c760..54fba640 100644 --- a/core/helpers/core_menu.php +++ b/core/helpers/core_menu.php @@ -115,7 +115,11 @@ class core_menu_Core { ->append(Menu::factory("link") ->id("graphics_toolkits") ->label(t("Graphics")) - ->url(url::site("admin/graphics")))) + ->url(url::site("admin/graphics"))) + ->append(Menu::factory("link") + ->id("languages") + ->label(t("Language Settings")) + ->url(url::site("admin/languages")))) ->append(Menu::factory("link") ->id("modules") ->label(t("Modules")) diff --git a/core/helpers/locale.php b/core/helpers/locale.php new file mode 100644 index 00000000..592f73b3 --- /dev/null +++ b/core/helpers/locale.php @@ -0,0 +1,214 @@ +<?php defined("SYSPATH") or die("No direct script access."); +/** + * Gallery - a web based photo album viewer and editor + * Copyright (C) 2000-2008 Bharat Mediratta + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** + * This is the API for handling locales. + */ +class locale_Core { + /** + * Return the list of available locales. + */ + public static function available() { + $locales = array(); + list ($supportedLanguages, $defaultCountry) = self::getLanguageData(); + foreach ($supportedLanguages as $language_tag => $country_locales) { + foreach ($country_locales as $country_tag => $entry) { + $locales[$language_tag . '_' . $country_tag] = + $entry['description']; + } + } + + return $locales; + } + + private static function getLanguageData() { + static $supportedLanguages = array(); + static $defaultCountry = array(); + + // TODO(andy_st): Might want to add a localizable language name as well. + if (empty($supportedLanguages)) { + /* English */ + $supportedLanguages['en']['US']['description'] = 'English (US)'; + $supportedLanguages['en']['GB']['description'] = 'English (UK)'; + $defaultCountry['en'] = 'US'; + + /* Afrikaans */ + $supportedLanguages['af']['ZA']['description'] = 'Afrikaans'; + $defaultCountry['af'] = 'ZA'; + + /* Catalan */ + $supportedLanguages['ca']['ES']['description'] = 'Catalan'; + $defaultCountry['ca'] = 'ES'; + + /* Czech */ + $supportedLanguages['cs']['CZ']['description'] = 'Česky'; + $defaultCountry['cs'] = 'CZ'; + + /* Danish */ + $supportedLanguages['da']['DK']['description'] = 'Dansk'; + $defaultCountry['da'] = 'DK'; + + /* German */ + $supportedLanguages['de']['DE']['description'] = 'Deutsch'; + $defaultCountry['de'] = 'DE'; + + /* Spanish */ + $supportedLanguages['es']['ES']['description'] = 'Español'; + $supportedLanguages['es']['MX']['description'] = 'Español (MX)'; + $supportedLanguages['es']['AR']['description'] = 'Español (AR)'; + $defaultCountry['es'] = 'ES'; + + /* Estonian */ + $supportedLanguages['et']['EE']['description'] = 'Eesti'; + $defaultCountry['et'] = 'EE'; + + /* Basque */ + $supportedLanguages['eu']['ES']['description'] = 'Euskara'; + $defaultCountry['eu'] = 'ES'; + + /* French */ + $supportedLanguages['fr']['FR']['description'] = 'Français'; + $defaultCountry['fr'] = 'FR'; + + /* Irish */ + $supportedLanguages['ga']['IE']['description'] = 'Gaeilge'; + $defaultCountry['ga'] = 'IE'; + + /* Greek */ + $supportedLanguages['el']['GR']['description'] = 'Greek'; + $defaultCountry['el'] = 'GR'; + + /* Icelandic */ + $supportedLanguages['is']['IS']['description'] = 'Icelandic'; + $defaultCountry['is'] = 'IS'; + + + /* Italian */ + $supportedLanguages['it']['IT']['description'] = 'Italiano'; + $defaultCountry['it'] = 'IT'; + + /* Latvian */ + $supportedLanguages['lv']['LV']['description'] = 'Latviešu'; + $defaultCountry['lv'] = 'LV'; + + /* Lithuanian */ + $supportedLanguages['lt']['LT']['description'] = 'Lietuvių'; + $defaultCountry['lt'] = 'LT'; + + /* Hungarian */ + $supportedLanguages['hu']['HU']['description'] = 'Magyar'; + $defaultCountry['hu'] = 'HU'; + + /* Dutch */ + $supportedLanguages['nl']['NL']['description'] = 'Nederlands'; + $defaultCountry['nl'] = 'NL'; + + /* Norwegian */ + $supportedLanguages['no']['NO']['description'] = 'Norsk bokmål'; + $defaultCountry['no'] = 'NO'; + + /* Polish */ + $supportedLanguages['pl']['PL']['description'] = 'Polski'; + $defaultCountry['pl'] = 'PL'; + + /* Portuguese */ + $supportedLanguages['pt']['BR']['description'] = 'Português Brasileiro'; + $supportedLanguages['pt']['PT']['description'] = 'Português'; + $defaultCountry['pt'] = 'PT'; + + /* Romanian */ + $supportedLanguages['ro']['RO']['description'] = 'Română'; + $defaultCountry['ro'] = 'RO'; + + /* Slovak */ + $supportedLanguages['sk']['SK']['description'] = 'Slovenčina'; + $defaultCountry['sk'] = 'SK'; + + /* Slovenian */ + $supportedLanguages['sl']['SI']['description'] = 'Slovenščina'; + $defaultCountry['sl'] = 'SI'; + + /* Serbian */ + $supportedLanguages['sr']['CS']['description'] = 'Srpski'; + $defaultCountry['sr'] = 'CS'; + + /* Finnish */ + $supportedLanguages['fi']['FI']['description'] = 'Suomi'; + $defaultCountry['fi'] = 'FI'; + + /* Swedish */ + $supportedLanguages['sv']['SE']['description'] = 'Svenska'; + $defaultCountry['sv'] = 'SE'; + + /* Ukrainian */ + $supportedLanguages['uk']['UA']['description'] = 'УкÑаÑнÑÑка'; + $defaultCountry['uk'] = 'UA'; + + /* Vietnamese */ + $supportedLanguages['vi']['VN']['description'] = 'Tiếng Việt'; + $defaultCountry['vi'] = 'VN'; + + /* Turkish */ + $supportedLanguages['tr']['TR']['description'] = 'Türkçe'; + $defaultCountry['tr'] = 'TR'; + + /* Bulgarian */ + $supportedLanguages['bg']['BG']['description'] = + 'Български'; + $defaultCountry['bg'] = 'BG'; + + /* Russian */ + $supportedLanguages['ru']['RU']['description'] = + 'Русский'; + $defaultCountry['ru'] = 'RU'; + + /* Chinese */ + $supportedLanguages['zh']['CN']['description'] = '简体中文'; + $supportedLanguages['zh']['TW']['description'] = '繁體中文'; + $defaultCountry['zh'] = 'CN'; + + /* Korean */ + $supportedLanguages['ko']['KR']['description'] = '한국말'; + $defaultCountry['ko'] = 'KR'; + + /* Japanese */ + $supportedLanguages['ja']['JP']['description'] = '日本語'; + $defaultCountry['ja'] = 'JP'; + + /* Arabic */ + $supportedLanguages['ar']['SA']['description'] = + 'العربية'; + $supportedLanguages['ar']['SA']['right-to-left'] = true; + $defaultCountry['ar'] = 'SA'; + + /* Hebrew */ + $supportedLanguages['he']['IL']['description'] = 'עברית'; + $supportedLanguages['he']['IL']['right-to-left'] = true; + $defaultCountry['he'] = 'IL'; + + /* Farsi */ + $supportedLanguages['fa']['IR']['description'] = 'فارسي'; + $supportedLanguages['fa']['IR']['right-to-left'] = true; + $defaultCountry['fa'] = 'IR'; + } + + return array($supportedLanguages, $defaultCountry); + } +} |