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.

Template Questions /

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

Translatable - template always use translation from en.yml file


Go to End


1813 Views

Avatar
Philippe

Community Member, 6 Posts

15 May 2014 at 4:31am

HI,

In a template I am using the following sentence

<p class="intro"><%t ParticipantsList.LASTUPDATE "Last Update : " %>$GetBPFLstEdt($PTable)</p>

it always displays the corresponding value in the en.yml file whatever language I choose when displaying the page e.g. //url/mypage/?locale=nl_NL

further in my template, I am doing the following (because I never got the translatable working):
<% if Locale == "fr_FR" %>
<th style="height: 15px; background-color: #87c6fc;" align="left">Nom, Prénom</th>
<th style="height: 15px; background-color: #87c6fc;" align="center">Nom, prévom du passager</th>
<th style="height: 15px; background-color: #87c6fc;" align="center">Etat</th>
<% else %>
<% if Locale == "nl_NL" %>
<th style="height: 15px; background-color: #87c6fc;" align="left">Naam, Voornaam</th>
<th style="height: 15px; background-color: #87c6fc;" align="center">Naam, voornaam v/d passagier</th>
<th style="height: 15px; background-color: #87c6fc;" align="center">Status</th>
<% else %>
<th style="height: 15px; background-color: #87c6fc;" align="left">Name, Forename</th>
<th style="height: 15px; background-color: #87c6fc;" align="center">Passenger</th>
<th style="height: 15px; background-color: #87c6fc;" align="center">State</th>
<% end_if %>
<% end_if %>

And this gives me the text in the language I want. This confirms that the $Locale variable contains the right value.
Why is <%t ParticipantsList.LASTUPDATE "Last Update : " %> not working?

I created a nl_NL.yml file containing the following:
nl_NL:
ParticipantsList:
DESCRIPTION: 'Generic content page'
LASTUPDATE: 'Laatste aanpassing: '
PLURALNAME: 'Participants Lists'
SINGULARNAME: 'Participants List'

and I created a nl.yml file containing the following:
nl:
ParticipantsList:
DESCRIPTION: 'Generic content page'
LASTUPDATE: 'Laatste aanpassing: '
PLURALNAME: 'Participants Lists'
SINGULARNAME: 'Participants List'

I rebuild the site using //url/dev/build/?flush=1
displayed the page using .../?flush=all

And I always get the translation from the en.yml file

who can help? what is wrong?
I don't know where to look anymore
Thank you for your support

Philippe