CC-1960: Internationalize Airtime / Support translations

-added i18n jquery library
-created a Locale controller that returns a js dictionary of translations needed in js
-added jquery i18n wrapper function to all strings in js
This commit is contained in:
denise 2012-11-20 11:16:10 -05:00
parent b801235c99
commit 57fdab0ddf
25 changed files with 472 additions and 209 deletions

View file

@ -15,7 +15,7 @@ function setWatchedDirEvents() {
imageUrl: 'img/icons/',
systemImageUrl: baseUrl+'/css/img/',
handlerUrl: baseUrl+'/Preference/server-browse/format/json',
title: 'Choose Storage Folder',
title: $.i18n._('Choose Storage Folder'),
basePath: '',
requestMethod: 'POST',
});
@ -35,7 +35,7 @@ function setWatchedDirEvents() {
imageUrl: 'img/icons/',
systemImageUrl: baseUrl+'/css/img/',
handlerUrl: baseUrl+'/Preference/server-browse/format/json',
title: 'Choose Folder to Watch',
title: $.i18n._('Choose Folder to Watch'),
basePath: '',
requestMethod: 'POST',
});
@ -43,7 +43,7 @@ function setWatchedDirEvents() {
$('#storageFolder-ok').click(function(){
var url, chosen;
if(confirm("Are you sure you want to change the storage folder?\nThis will remove the files from your Airtime library!")){
if(confirm($.i18n._("Are you sure you want to change the storage folder?\nThis will remove the files from your Airtime library!"))){
url = baseUrl+"/Preference/change-stor-directory";
chosen = $('#storageFolder').val();
@ -72,7 +72,7 @@ function setWatchedDirEvents() {
function(json) {
$("#watched-folder-section").empty();
$("#watched-folder-section").append("<h2>Manage Media Folders</h2>");
$("#watched-folder-section").append("<h2>"+$.i18n._("Manage Media Folders")+"</h2>");
$("#watched-folder-section").append(json.subform);
setWatchedDirEvents();
});
@ -84,7 +84,7 @@ function setWatchedDirEvents() {
});
$('.selected-item').find('.ui-icon-close').click(function(){
if(confirm("Are you sure you want to remove the watched folder?")){
if(confirm($.i18n._("Are you sure you want to remove the watched folder?"))){
var row = $(this).parent();
var folder = row.find('#folderPath').text();
@ -95,7 +95,7 @@ function setWatchedDirEvents() {
function(json) {
$("#watched-folder-section").empty();
$("#watched-folder-section").append("<h2>Manage Media Folders</h2>");
$("#watched-folder-section").append("<h2>"+$.i18n._("Manage Media Folders")+"</h2>");
$("#watched-folder-section").append(json.subform);
setWatchedDirEvents();
});
@ -108,7 +108,7 @@ $(document).ready(function() {
setWatchedDirEvents();
$(".ui-icon-alert").qtip({
content: {
text: "This path is currently not accessible."
text: $.i18n._("This path is currently not accessible.")
},
position:{
adjust: {

View file

@ -93,13 +93,13 @@ function checkLiquidsoapStatus(){
}
var html;
if(status == "OK"){
html = '<div class="stream-status status-good"><h3>Connected to the streaming server</h3></div>';
html = '<div class="stream-status status-good"><h3>'+$.i18n._("Connected to the streaming server")+'</h3></div>';
}else if(status == "N/A"){
html = '<div class="stream-status status-disabled"><h3>The stream is disabled</h3></div>';
html = '<div class="stream-status status-disabled"><h3>'+$.i18n._("The stream is disabled")+'</h3></div>';
}else if(status == "waiting"){
html = '<div class="stream-status status-info"><h3>Getting information from the server...</h3></div>';
html = '<div class="stream-status status-info"><h3>'+$.i18n._("Getting information from the server...")+'</h3></div>';
}else{
html = '<div class="stream-status status-error"><h3>Can not connect to the streaming server</h3><p>'+status+'</p></div>';
html = '<div class="stream-status status-error"><h3>'+$.i18n._("Can not connect to the streaming server")+'</h3><p>'+status+'</p></div>';
}
$("#s"+id+"Liquidsoap-error-msg-element").html(html);
}
@ -250,7 +250,8 @@ function setupEventListeners() {
// qtip for help text
$(".override_help_icon").qtip({
content: {
text: "If Airtime is behind a router or firewall, you may need to configure port forwarding and this field information will be incorrect. In this case you will need to manually update this field so it shows the correct host/port/mount that your DJ's need to connect to. The allowed range is between 1024 and 49151. For more detail, please read the <a target=\"_blank\" href=\"http://www.sourcefabric.org/en/airtime/manuals/\">Airtime manual</a>."
text: $.i18n._("If Airtime is behind a router or firewall, you may need to configure port forwarding and this field information will be incorrect. In this case you will need to manually update this field so it shows the correct host/port/mount that your DJ's need to connect to. The allowed range is between 1024 and 49151.")+" "+
$.i18n._("For more details, please read the ")+"<a target=\"_blank\" href=\"http://www.sourcefabric.org/en/airtime/manuals/\">"+$.i18n._("Airtime manual")+"</a>."
},
hide: {
delay: 500,
@ -271,7 +272,7 @@ function setupEventListeners() {
$(".icecast_metadata_help_icon").qtip({
content: {
text: "Check this option to enable metadata for OGG streams (stream metadata is the track title, artist, and show name that is displayed in an audio player). VLC and mplayer have a serious bug when playing an OGG/VORBIS stream that has metadata information enabled: they will disconnect from the stream after every song. If you are using an OGG stream and your listeners do not require support for these audio players, then feel free to enable this option."
text: $.i18n._("Check this option to enable metadata for OGG streams (stream metadata is the track title, artist, and show name that is displayed in an audio player). VLC and mplayer have a serious bug when playing an OGG/VORBIS stream that has metadata information enabled: they will disconnect from the stream after every song. If you are using an OGG stream and your listeners do not require support for these audio players, then feel free to enable this option.")
},
hide: {
delay: 500,
@ -292,7 +293,7 @@ function setupEventListeners() {
$("#auto_transition_help").qtip({
content: {
text: "Check this box to automatically switch off Master/Show source upon source disconnection."
text: $.i18n._("Check this box to automatically switch off Master/Show source upon source disconnection.")
},
hide: {
delay: 500,
@ -313,7 +314,7 @@ function setupEventListeners() {
$("#auto_switch_help").qtip({
content: {
text: "Check this box to automatically switch on Master/Show source upon source connection."
text: $.i18n._("Check this box to automatically switch on Master/Show source upon source connection.")
},
hide: {
delay: 500,
@ -334,7 +335,7 @@ function setupEventListeners() {
$(".stream_username_help_icon").qtip({
content: {
text: "If your Icecast server expects a username of 'source', this field can be left blank."
text: $.i18n._("If your Icecast server expects a username of 'source', this field can be left blank.")
},
hide: {
delay: 500,
@ -355,7 +356,7 @@ function setupEventListeners() {
$(".master_username_help_icon").qtip({
content: {
text: "If your live streaming client does not ask for a username, this field should be 'source'."
text: $.i18n._("If your live streaming client does not ask for a username, this field should be 'source'.")
},
hide: {
delay: 500,
@ -375,12 +376,7 @@ function setupEventListeners() {
})
$('#stream_save').live('click', function(){
var confirm_pypo_restart_text = "If you change the username or password values for an enabled stream the "
+ "playout engine will be rebooted and your listeners will hear silence for"
+ "5-10 seconds. Changing the following fields will NOT cause a reboot: "
+ "Stream Label (Global Settings), and Switch Transition Fade(s), Master "
+ "Username, and Master Password (Input Stream Settings). If Airtime is recording"
+ ", and if the change causes a playout engine restart, the recording will be interrupted.";
var confirm_pypo_restart_text = $.i18n._("If you change the username or password values for an enabled stream the playout engine will be rebooted and your listeners will hear silence for 5-10 seconds. Changing the following fields will NOT cause a reboot: Stream Label (Global Settings), and Switch Transition Fade(s), Master Username, and Master Password (Input Stream Settings). If Airtime is recording, and if the change causes a playout engine restart, the recording will be interrupted.");
if (confirm(confirm_pypo_restart_text)) {
var data = $('#stream_form').serialize();
var url = baseUrl+'/Preference/stream-setting';

View file

@ -61,7 +61,7 @@ $(document).ready(function() {
var ul, li;
ul = logoEl.find('.errors');
li = $("<li/>").append("Image must be one of jpg, jpeg, png, or gif");
li = $("<li/>").append($.i18n._("Image must be one of jpg, jpeg, png, or gif"));
//errors ul has already been created.
if (ul.length > 0) {