22976 Posts in 11702 Topics by 2826 members
|Go to End|
18 December 2009 at 11:30am
Can someone please explain to me how I have to use the _t function in my templates with php and with js?
I have translatable and i18n turned on in my config and everything seems ok (login page is German and I can create translations)
In sapphire/lang/de_DE.php it says: $lang['de_DE']['SearchForm']['SEARCH'] = 'Suche';
In sapphire/lang/en_US.php it says: $lang['de_DE']['SearchForm']['SEARCH'] = 'Search';
I use _t('SEARCHFORM.SEARCH') in my page.php to set the text of the searchbutton, but the searchbutton gets no text (and there is no error).
i18n.js loads de_DE and en_US language files, and the translation for SEARCHFORM.SEARCH is in those files. However, if I use <% _t('SEARCHFORM.SEARCH') %> the result is again empty.
I have looked everywhere in wiki and forum and book, but I can not find anything, so it must be something fairly obvious that I am missing
18 December 2009 at 12:01pm
Well, SearchForm and SEARCHFORM are two different strings, arenâ€™t they?
Hope it helps,
18 December 2009 at 1:13pm Last edited: 18 December 2009 1:46pm
Ok both now work, I feel a bit stupid
I thought one would go over the js and one not, but they both go over the php
Alas they are now somehow both in german... I will look into it
EDIT: it worked completely as soon as I reinserted the code below into the page_controller->init even though it changes the language of the login form (part is in german, the other part is in english):
|Go to Top|