Jump to content

multi-language url OK but static text ?


Doc
 Share

Recommended Posts

Hi guys,

I've been playing with PW for a few days now, having fun so far.

I'm testing the multi-language capability features.

I've read https://processwire.com/api/multi-language-support/code-i18n/ and https://processwire.com/api/multi-language-support/multi-language-urls/.

I succeeded to display a page in my default language, then by adding "/en", display the "en" version and so on.

So I understand how to manage the description part of the website which won't be modify very often, great.

But I don't get it for text such as : sprintf(__('Your city is %1$s, and your zip code is %2$s.'), $city, $zipcode);

I mean I get it about the sprintf stuff, I used to have such a system on my old website, with countries include files en.inc, it.inc.

What I don't understand is how PW will load the english text, the italian text ? Do I have to build myself the matching countries files according to the language set on the page ?

Something like if 'en' then include ('en.inc'); ?

Thanks

Link to comment
Share on other sites

I think I get it, I've just read : https://processwire.com/talk/topic/3644-translate-static-strings-in-the-templates-folder/

@Soma made me understand the process (I think).

I probably going to use something like that with a single translation file/language (I have the same sentences multiple times on different templates).

So to sum up :

- I'll use multi-language textarea field in my backend to manage description which doesn't change often.

- I'll use a single translation file / language, loaded dynamically according to the language used by the template.

Sounds good to the pro ?

Thanks

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...