Is there any "EASY" way to convert web sites to another language?

I’m pretty sure I know that answer but since I’m not 100% sure I’m asking. A pizza oven maker in Italy noticed my pizza dough, sauce and cheese calculator and asked if there was anyway to have it display Italian instead of english. I’m new at web design and still struggling with simple things like cookies and radio buttons so this would need to be as easy as turning on a light switch for me to implement it.

Wondering if their is some mechanism within Wappler (or reachable via API) that would automatically convert my page (if a button was pressed or possibly based on the users IP address origination location)?

I did see this “you can handle translations really well with app connect dynamic bindings and database with translations. So you can have a server connect action fetching the data for the current language and then just populate the dynamic texts on the page.” but that seems really hard and I doubt I could figure it out or set it up. Hoping with all the cool stuff on the web someone would have a simple solution…

Hi Norm,
The answer is YES, you can have multi-language site of course.

There are two ways of doing this.

  1. Using a cookie. You set a cookie that stores the language. Then you have two variants of your texts on the page and you show the one corresponding on your cookie value, using the show/hide dynamic attributes:
<p dmx-show="cookie.language == 'en'">I like pizza</p>

and

<p dmx-show="cookie.language == 'it'">mi piace la pizza</p>
  1. Create two versions of your page, and put them in two subfolders site.com/en/ and site.com/it/ - then redirect users with a link.

BTW that’s a nice topic for a tutorial i should make :slight_smile:

3 Likes

Thanks Teodor I’ll put this on my to-do list…

1 Like

As a quick and dirty fix you can add google translate to your website. Here is a link to adding the “widget”.
https://translate.google.com/manager/website/

1 Like

Wow, thanks so much - that was so easy and works great - finally I’m a man of international mystery!!!

Thanks again Brian, hope you have a great Sunday!

1 Like

Don’t relay on google translate its robotic and don’t make sense.
And havig double versions of everything is not practical at all.

How about you bind the text attribute of every element you want to translate with a value in the database.
This way you can add a new language anytime. And don’t have to change anything in the page after the first setup.

It is practical for static content in your templates. For dynamic content you just do it like:

{{cookie.language == 'en' ? content_en : content_it}}

Yea but that will still limit if you want to add another language in the future.

And he will be brone to making a mistake when setting a condition to all the elements dont you think?

And since its with wappler he can save the languages in a json file so no need for a database

1 Like

Well, yes there are multiple ways of doing this. JSON file with the translations is a nice solution!

I’m not smart enough to know how to implement anything with a JSON file (I still count on my fingers) :smiley:

But thanks for trying to help me guys - maybe someday…

Check also:

2 Likes