Not signed in (Sign In)
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthortamboo
    • CommentTimeJan 7th 2008
     
    Hello!
    Thank you for a great framework.

    I want to make the locale file that can be shared.
    How do you make it?
    • CommentAuthorKaste
    • CommentTimeJan 7th 2008
     

    If understand your question right, this should lead you in the right way.

    In a view we have the text_helper for that:

    <?php echo $text_helper->translate(string,array_of_variables_to_bind,scope); ?>
    
    <?php echo $text_helper->translate(
                            'This is %what',
                            array('%what'=>'super'),
                            'global_shared'
    ); ?>
    

    This will create the folder "global_shared" under app/locales

    Unfortunately you can't use Sintags for this, right now.

    • CommentAuthorKaste
    • CommentTimeJan 7th 2008
     

    the translate has an alias: t().

    if you don't define a scope, it usually guesses one (the controller name or the model name).

    • CommentAuthorKaste
    • CommentTimeJan 7th 2008
     

    Unfortunately you can't use Sintags for this

    I was wrong. I first tried

    <%= translate 'Take me %where', :where=>"home", "scope" %>
    

    which leads to translate('Take me %where',array('where'=>'home','scope')), which is wrong, because 'scope' should be our third argument.

    So we have to be more specific.

    <%= translate 'Take me %where', {"%where"=>"home"}, "scope" %>
    

    is correct and works as expected.

    • CommentAuthortamboo
    • CommentTimeJan 9th 2008 edited
     
    That explains it.

    Thanks, Kaste.
Add your comments
    Username Password
  • Format comments as