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.

Archive /

Our old forums are still available as a read-only archive.

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

More doubts (templates translations)


Go to End


2 Posts   1360 Views

Avatar
rbarreiros

Community Member, 21 Posts

26 November 2007 at 3:13pm

Hello,

you guys must be calling me a pain in the neck already :)

Ok here we go, attempting to translate some templates, i've got some questions regarding templating fallback, they're translations and unecessary files.

I was trying to translate the string 'Displaying X to Y of Z' in the MemberTable, logically i went to the cms, searched the templates, and found MemberList_PageControls.ss in Includes dir.
So i added the <% _t() %> to it, added $lang['en_US']['MemberList_PageControls.ss']['DISPLAYING'] to both files (yes i changed the locale on the pt_PT.php) and no change on the UI.

so, i grep the whole source for the string and found:
cms/templates/Includes/MemberList_PageControls.ss
sapphire/templates/Includes/TableList_PageControls.ss

to test, i did the same on TableList_PageControls.ss like i did on MemberList_PageControls.ss and added the $lang.....['TableList_PageControls.ss'].... to the lang files and it worked.

Questions:

a) how does the template fallback works with translation
I mean, cms has the template for MemberList_PageControls.ss, shouldn't it use MemberList_PageControls.ss and discard the remaining ones, and translate ofc the strings present in it ?

b) how should we translate template strings on cms that fallback to sapphire templates ? Several cms classes extend sapphire is there a way to keep cms translations independent of sapphire template fallbacks ? (i think this would be the best option,instead of having to translate sapphire in order to have cms translated, since i assume they're 2 different things)

c) Is there really a need to fallback to sapphire templates from cms ?
If cms wants to be a 'module' independent from sapphire (from which it extends) and sapphire the 'framework' shouldn't cms have all templates (even if repeated) so that when working with cms we wouldn't have to fiddle into sapphire to change/fix/add something that is only dependent of cms (not talking about framework functionality)

Just some inocent questions to understand better how ss works and ofc how you guys as core developers think of how it should work.

Best regards,

Avatar
Ingo

Forum Moderator, 801 Posts

26 November 2007 at 8:49pm

> a) how does the template fallback works with translation
currently we don't have template-level inheritance. template-naming doesn't necessarily follow conventions (<classname>_<customname>), and we don't know in which context a template is rendered, so determining inheritance is tricky. we're always open for practical solutions (and patches) though

> b) how should we translate template strings on cms that fallback to sapphire templates ?
currently the only solution is to translate them twice, sorry.
in terms of dependencies, you're right to assume that sapphire should work independently of cms, while cms will have sapphire as a base-dependency in the foreseeable future