Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Problems adding new language File


Go to End


3 Posts   1774 Views

Avatar
webair

Community Member, 8 Posts

5 September 2010 at 12:54am

Hi

I have problems creating a custom language File for my module. i followed the instruction from the i18n docs, but my translation file doesn't get loaded.

my module is called event and has a Layout called Event.ss. In there i call for example <% _t('INFORMATION','__TEST__') %>. in my language file i wrote:

global $lang;
$lang['en_US']['Event.ss']['INFORMATION'] = 'Event information';

but it does not appear when i view my page. Also i can make syntax errors or var_dumps in the lang file without getting them displayed. Can anyone help me here?

i run silverstripe 2.4.1

Thanks alot,

webair

Avatar
Martijn

Community Member, 271 Posts

5 September 2010 at 11:46am

Removing ['Event.ss'] in the lang string should solve this.

Avatar
webair

Community Member, 8 Posts

9 September 2010 at 8:23pm

Edited: 09/09/2010 8:37pm

Thanks for the answer.

sadly it didn't worked. it seems like the language file from the module doesn't get loaded. but i don't know why...

best regards
webair

[EDIT] here my config settings for the i18n and translatable

i18n::set_default_lang('de');
i18n::set_locale('de_CH');
i18n::$common_locales['fr_CH'] = array('French (Switzerland)', 'fran&ccedil;ais (Suisse)');

Translatable::set_default_locale('de_CH');
Translatable::set_allowed_locales(array('de_CH','en_US','fr_CH'));

[EDIT]