summaryrefslogtreecommitdiff
path: root/core/helpers/locale.php
diff options
context:
space:
mode:
authorAndy Staudacher <andy.st@gmail.com>2009-02-19 08:48:14 +0000
committerAndy Staudacher <andy.st@gmail.com>2009-02-19 08:48:14 +0000
commit237656f6c85697c41a935d0b05979cebbb2cc87b (patch)
treea2d8d5a897d5355a94a59b4272282b36cb9570b6 /core/helpers/locale.php
parentd47e4c9b43aca6092c1555c392ae072d449bb888 (diff)
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)
Diffstat (limited to 'core/helpers/locale.php')
-rw-r--r--core/helpers/locale.php20
1 files changed, 20 insertions, 0 deletions
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