Tuxemon / Tuxemon-Website

Node.js implementation of the Tuxemon.org website.
GNU General Public License v3.0
3 stars 6 forks source link

Translate the website #1

Open airon90 opened 8 years ago

airon90 commented 8 years ago

How can I translate the website into Italian and Esperanto?

ShadowApex commented 8 years ago

This will take a little work to implement correctly. Ideally we should have a set of files that contain all of the website's text in various different languages, then we can use the appropriate language text in the view of the page being rendered.

Here's an example of what I was thinking:

tuxemon/lang/en_US.js

var carouselTitle1 = "Open source turn-based RPG.";
var carouselText1 = "Completely open source monster fighting RPG. Capture and battle monsters against others!";
...

tuxemon/lang/eo_EO.js

var carouselTitle1 = "Apertfonta deĵoroj RPG.";
var carouselText1 = "Tute malferma fonto monstro batalado RPG. Kaptu kaj batali monstroj kontraŭ aliaj!";
...

Then after we have all of the page text available in various different languages, in the index.ejs view, I can render the text like this based on the selected language:

tuxemon/views/pages/index.ejs

...
<div class="carousel-caption">
  <h1><%= carouselTitle1 %></h1>
  <p><%= carouselText1 %></p>
...