Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

translation of dynamic data

edited March 2014 in I18n

Suppose a query that returns a state based on a SQL CASE statement named "status".

Now I show the results in the view by {{Loop_value-> status}}

It would be possible to have the translation as usual {"Translate me"}.

E.g. {" {{Loop_value-> status}} "}

Of course I do not expect that rebuilding the translations index works for that too.

Thanks.

Comments

  • You can still filter those values via {{loop_value->status|__}} which calls the __() function as a filter, but to have the indexer find those strings so you can translate them you may need to include them in your code somewhere else.

    One thing I've had to do before was create an extra file like apps/myapp/handlers/translations.php with all my app's dynamic strings like this:

    <?php
    __ ('Approved');
    __ ('Pending');
    

    This way the indexer will pick them up, but the code is never called directly so even though it's a bit of a hack, at least it doesn't slow anything down :)

  • That's just great!

    Thanks.

Sign In or Register to comment.