How to use smarty to translate a website?

98 views Asked by At

I want to use SMARTY to make a multi langage website.

I read this article: http://www.freesoftwaremagazine.com/articles/creating_multilingual_website_smarty

However it does not work with smarty3 and I don't know exactly how these configs work: I am new to smarty.

ex: my website content is now

hello world, how are you

Can I use spaces in my variables so, I don't have to rewrite it all like:

{$hello_world_how_are_you}

but I would rather keep something like

{hello world, how are you} or

/#hello world, how are you#/

To avoid to rewrite slugs to each phrase I have to translate

1

There are 1 answers

0
mleko On

You can use array syntax

For example

{$lang['hello world, how are you']}

This have another advantage that you don't pollute your variable scope.