Dynamic variables on translation strings

28 views
Skip to first unread message

ved

unread,
Nov 30, 2016, 5:38:39 AM11/30/16
to f3-fra...@googlegroups.com
Hey guys,

I have a few translation strings as follows in an .ini file:

lang_product_typeone = Product type one
lang_product_typetwo
= Product type two


From the database I get only "typeone" or "typetwo". 

Is it possible to use those translation strings by somehow concatenating "lang_product_" with the result from the database and get the corresponding translation?

I've tried
{{ @lang_product_.@dbresult }}

and some other combinations with parenthesis, quotes, etc, but it doesn't seem to work.

Any ideas on how to best achieve this?

Thanks



ikkez

unread,
Nov 30, 2016, 9:18:04 AM11/30/16
to Fat-Free Framework
you could write:

lang_product.typeone = Product type one
lang_product.typetwo
= Product type two

and in template:

{{ @lang_product[@dbresult] }}

ved

unread,
Nov 30, 2016, 9:37:21 AM11/30/16
to Fat-Free Framework
Hey ikkez, thanks for the insight!

I completely forgot that translation ini's are pretty much just like other ini's on F3 and I can use the array notation there.

This solves my issue! Thanks again man.
Reply all
Reply to author
Forward
0 new messages