17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 10441 Views |
-
Enable translation of templates (i18n)

9 March 2008 at 1:26am
Hi,
I have been struggling some time trying to translate some of the templates of my site. This example below is done on a fresh install of SS 2.2.1.
This is what I tried and what happens...
1) add the i18n::enable(); to my _config.php file in mysite folder.
2) run the /db/build
3) open my Page.ss file in my Theme directory and add <% _t('LOGOTEXT', 'my logo') %> to the template
4) run the /i18n/textcollector and it says it created three files (cms, saphire, auth_openid). Shouldn't it create one for mysite too?
5) I try to go to my site, I get FATAL ERROR: Locale file /lang/en_US.php should exist
At line 1251 in C:\xampp\htdocs\ss2\sapphire\core\i18n.phpI tried to create a new en_US.php file and place it in a lang folder. But where should it be placed? I thought I should place it in the mysite folder, but that doesn't work.
Anyone that can see that I have done wrong?
many thanks!
-
Re: Enable translation of templates (i18n)

22 April 2008 at 3:14am
I know that you are still working on a i18n modules final versions. But I have the same kind of issue, I do not success to use themes and the function _t in a templates.
From what i read in the log irc, I can forget to use this in the templates of the widget but it works in the templates of a pages.
So my questions is very similar than tobbe.Where should I put my lang folder:
- mysite\lang\en_US.php (in my site)
- or themes\Mythemes\lang\en_US.php or themes\lang\en_US.php (in a theme folder)Or both ?
And after when you run http://localhost/silverstripe-v2.2.1/i18n/textcollector/
Should you see appears this folders ? because in fact I tried the 3 solutions above and at each time I just saw :Collecting text...
Created file: C:/wamp/www/silverstripe-v2.2.1/auth_openid/lang/en_US.php
Created file: C:/wamp/www/silverstripe-v2.2.1/cms/lang/en_US.php
Created file: C:/wamp/www/silverstripe-v2.2.1/sapphire/lang/en_US.php
Done!Notice: I am able to use the class that I had in mysite/lang in the file code/page.php by the _t
But not in the templates... Could you explain me the difference? How to manage templates and lang ?Thank you very much
| 10441 Views | ||
|
Page:
1
|
Go to Top |

