21281 Posts in 5729 Topics by 2600 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1170 Views |
-
Translatable and PHP language tables

19 August 2009 at 10:34pm
Hello
I'm upgrading my old page based on ss 2.2.3 to new 2.3.3 wit new multilang future.
The problem is that I have static typed form in page type ContacPage.php with labels like name surname, subject ...
This problem is common in many cases so I red in doc that there is something like php language tables.
I made in mysite/lang two files pl_PL.php and en_US.php and in contact form:new TextField(_t('ContactForm.NAMESURNAME', "ImiÄ™ i Nazwisko")
where in pl_PL.php I have :
$lang['pl_PL']['ContactForm']['NAMESURNAME'] = 'foo:';
What I'm doing wrong?
Maybe there is some better way to do same? -
Re: Translatable and PHP language tables

20 August 2009 at 12:48am
Hmmm I guess this is more or less the same question as my post: http://www.silverstripe.org/general-questions/show/267119#post267119. Basically, more info and examples on the locale files.
-
Re: Translatable and PHP language tables

20 August 2009 at 2:30am
add this line into your mysite/_config.php file
Object::add_extension('SiteTree', 'Translatable');and then add this to your Page_Controller in mysite/code/Page.php
if($this->dataRecord->hasExtension('Translatable')) {
i18n::set_locale($this->dataRecord->Locale);
}That should do the trick
-
Re: Translatable and PHP language tables

20 August 2009 at 4:09am
Thanks Xeal.
Don’t know if this solves my problem though. I get a blank page if I add that code to the Page_Controller.
-
Re: Translatable and PHP language tables

20 August 2009 at 6:20pm
Cool works for me if pasted in PageController::init() method
| 1170 Views | ||
|
Page:
1
|
Go to Top |



