From 237656f6c85697c41a935d0b05979cebbb2cc87b Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Thu, 19 Feb 2009 08:48:14 +0000 Subject: Differentiate between available and installed languages. Provide admin UI to install languages. See: https://apps.sourceforge.net/trac/gallery/ticket/75 (first step for this task) --- core/helpers/locale.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'core/helpers') diff --git a/core/helpers/locale.php b/core/helpers/locale.php index 6605f2af..e0e40c0e 100644 --- a/core/helpers/locale.php +++ b/core/helpers/locale.php @@ -35,6 +35,26 @@ class locale_Core { return self::$locales; } + static function installed() { + $available = self::available(); + $default = module::get_var("core", "default_locale"); + $codes = explode("|", module::get_var("core", "installed_locales", $default)); + foreach ($codes as $code) { + if (isset($available->$code)) { + $installed->$code = $available->$code; + } + } + return $installed; + } + + static function update_installed($locales) { + // Ensure that the default is included... + $default = module::get_var("core", "default_locale"); + $locales = array_merge($locales, array($default)); + + module::set_var('core', 'installed_locales', join("|", $locales)); + } + // TODO(andy_st): Might want to add a localizable language name as well. private static function _init_language_data() { $l->af_ZA = 'Afrikaans'; // Afrikaans -- cgit v1.2.3