Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » More doubts (templates translations)

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

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

Page: 1
Go to End
Author Topic: 1017 Views
  • rbarreiros
    Avatar
    Community Member
    21 Posts

    More doubts (templates translations) Link to this post

    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,

  • Ingo
    Avatar
    Forum Moderator
    801 Posts

    Re: More doubts (templates translations) Link to this post

    > 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

    1017 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.