Hi,
my website uses multilingual content and for sure I have to translate my templates also. Example:
mymodule/templates/BigPage1.ss
<h1><% _t("TITLE1","This is the BigPage1.ss") %></h1>
<p><% include SmallPage %></p>
mymodule/templates/BigPage2.ss
<h1><% _t("TITLE2","This is the BigPage2.ss") %></h1>
<p><% include SmallPage %></p>
mymodule/includes/SmallPage.ss
<% _t("SAMPLE","Just a sample text.") %>
So, where to store the content now? Should I save the "en_US.php" in mymodule/lang/ or in mysite/lang/. What about contents in /themes/mytheme/ ? This is my first question, because I don't really get it, that you have to store the translated data in mysite/lang, when you translate your themes!? Ain't it?
Well, let's go to my second question: After finding where to store my translated pieces I should now how to save them. I've read that you always have to address the highest template, else the variable is not found. As far as I know the following code will not work
$lang['en_US']['SmallPage.ss']['SAMPLE'] = "The translated text";
$lang['en_US']['BigPage1.ss']['TITLE1'] = "Title of BigPage1";
$lang['en_US']['BigPage2.ss']['TITLE2'] = "Title of BigPage2";
at least for the including of the small page because you should use BigPage.ss instead. To make my example work I need the following, dont I?
$lang['en_US']['BigPage1.ss']['SAMPLE'] = "The translated text";
$lang['en_US']['BigPage2.ss']['SAMPLE'] = "The translated text";
$lang['en_US']['BigPage1.ss']['TITLE1'] = "Title of BigPage1";
$lang['en_US']['BigPage2.ss']['TITLE2'] = "Title of BigPage2";
are there any regulations to follow? I'd appreciate a link or an explanation to where the template content is searched by silverstripe. oh man, I wrote so much, I hope anybody answers...
Greetings
pepperoni