v2.3.2 still trying to figure out a way to show available translation on the template of my page.
Been following this doc : http://doc.silverstripe.com/doku.php?id=multilingualcontent&s=get%20common%20locales
Under the code for Template, the doc mentioned: "Keep in mind that this will only show you available translations for the current page. The $Locale.Nice casting will just work if your locale value is registered in i18n::get_common_locales(). "
Now, I got stuck on how you can register the locale value in i18n::get_common_locales()
I did manage to find the file named"DBLocale.php, and this is what it has in it
<?php
/**
* Locale database field, mainly used in {@link Translatable} extension.
*
* @todo Allowing showing locale values in different languages through Nice()
*
* @package sapphire
* @subpackage i18n
*/
class DBLocale extends Varchar {
function __construct($name, $size = 16) {
parent::__construct($name, $size);
}
function Nice() {
return $this->getShortName();
}
function RFC1766() {
return i18n::convert_rfc1766($this->value);
}
function getShortName() {
$common_names = i18n::get_common_locales();
return (isset($common_names[$this->value])) ? $common_names[$this->value] : false;
}
function getLongName() {
return i18n::get_locale_name($this->value);
}
}
?>
Now, does anyone know how I can register the locales for this? Please help! Thank you!