return $this->_nativegettext;
}
-
+ /**
+ * Set native locale for getText.
+ *
+ * @param string $locale
+ */
protected function setNativeGettextLocale($locale) {
$locale .= '.utf8';
}
+ /**
+ * Set getText locale.
+ *
+ * @param string $locale
+ */
protected function setPhpGettextLocale($locale) {
// we support both the old file hierarchy format and the new:
}
-
/**
* Return languages available in this instance of CiviCRM.
*
if (!$all) {
$all = CRM_Contact_BAO_Contact::buildOptions('preferred_language');
+ // get labels
+ $rows = array();
+ $labels = array();
+ CRM_Core_OptionValue::getValues(array('name' => 'languages'), $rows);
+ foreach ($rows as $id => $row) {
+ $labels[$row['name']] = $row['label'];
+ }
+
// check which ones are available; add them to $all if not there already
$codes = array();
if (is_dir(CRM_Core_I18n::getResourceDir()) && $dir = opendir(CRM_Core_I18n::getResourceDir())) {
if (preg_match('/^[a-z][a-z]_[A-Z][A-Z]$/', $filename)) {
$codes[] = $filename;
if (!isset($all[$filename])) {
- $all[$filename] = $filename;
+ $all[$filename] = $labels[$filename];
}
}
}
unset($all[$code]);
}
}
+
+ ksort($all);
}
if ($enabled === NULL) {
return strtr($str, $tr);
}
+ /**
+ * Get the directory for l10n resources.
+ *
+ * @return string
+ */
public static function getResourceDir() {
static $dir = NULL;
if ($dir === NULL) {