Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

language translations #850

Merged
merged 4 commits into from
Aug 27, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 23 additions & 27 deletions lib/language.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ function init() {
return language;
}

var languages = [
{ code: 'bg', language: 'Български език' }
, { code: 'hr', language: 'Hrvatski' }
, { code: 'cz', language: 'Čeština' }
, { code: 'dk', language: 'Dansk' }
, { code: 'en', language: 'English' }
, { code: 'fr', language: 'Français' }
, { code: 'de', language: 'Deutsch' }
, { code: 'it', language: 'Italiano' }
, { code: 'pt', language: 'Português (Brasil)' }
, { code: 'ro', language: 'Română' }
, { code: 'es', language: 'Español' }
, { code: 'sv', language: 'Svenska' }
];

var translations = {
// Server
'Listening on port' : {
Expand All @@ -22,32 +37,6 @@ function init() {
,dk: 'Lytter på port'
}
// Client
,'Language' : {
}
, 'Bulgarian': {
}
, 'Croatian': {
}
, 'Czech': {
}
, 'English': {
}
, 'French': {
}
, 'German': {
}
, 'Italian': {
}
, 'Portuguese (Brazil)': {
}
, 'Romanian': {
}
, 'Spanish': {
}
, 'Swedish': {
}
, 'Danish': {
}
,'Mo' : {
cs: 'Po'
,de: 'Mo'
Expand Down Expand Up @@ -3404,13 +3393,16 @@ function init() {
,it: 'Tempo'
,dk: 'Kulhydratstid'
}
,'Language' : {
cs: 'Jazyk'
}

};

language.translate = function translate(text) {
if (translations[text] && translations[text][lang]) {
return translations[text][lang];
}
}
return text;
};

Expand All @@ -3424,6 +3416,10 @@ function init() {
$(this).attr('original-title',language.translate($(this).attr('original-title')));
$(this).attr('placeholder',language.translate($(this).attr('placeholder')));
});
// prepare languages list
for (var l=0; l<languages.length; l++) {
$('#language').append('<option value="' + languages[l].code+ '">' + languages[l].language + '</option>');
}
};

language.set = function set(newlang) {
Expand Down
12 changes: 0 additions & 12 deletions static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,6 @@
<dt class="translate">Language</dt>
<dd>
<select id="language">
<option value="bg" class="translate">Bulgarian</option>
<option value="hr" class="translate">Croatian</option>
<option value="cs" class="translate">Czech</option>
<option value="dk" class="translate">Danish</option>
<option value="en" class="translate">English</option>
<option value="fr" class="translate">French</option>
<option value="de" class="translate">German</option>
<option value="it" class="translate">Italian</option>
<option value="pt" class="translate">Portuguese (Brazil)</option>
<option value="ro" class="translate">Romanian</option>
<option value="es" class="translate">Spanish</option>
<option value="sv" class="translate">Swedish</option>
</select>
</dd>
</dl>
Expand Down