From 10cd31fa5676e891fc2d6c04495186f7182fbe12 Mon Sep 17 00:00:00 2001 From: denise Date: Tue, 20 Nov 2012 17:42:26 -0500 Subject: [PATCH] CC-1960: Internationalize Airtime / Support translations - channged all js strings with embedded variables to use sprintf --- .../controllers/LocaleController.php | 23 +++++++------------ .../library/events/library_playlistbuilder.js | 4 ++-- .../library/events/library_showbuilder.js | 4 ++-- .../js/airtime/preferences/streamsetting.js | 3 ++- .../public/js/airtime/showbuilder/builder.js | 4 ++-- 5 files changed, 16 insertions(+), 22 deletions(-) diff --git a/airtime_mvc/application/controllers/LocaleController.php b/airtime_mvc/application/controllers/LocaleController.php index 1b0b53648..eb92a1034 100644 --- a/airtime_mvc/application/controllers/LocaleController.php +++ b/airtime_mvc/application/controllers/LocaleController.php @@ -41,17 +41,14 @@ class LocaleController extends Zend_Controller_Action //library/events/library_playlistbuilder.js " Add to current playlist" => _(" Add to current playlist"), " Add to current smart block" => _(" Add to current smart block"), - "Adding 1 Item." => _("Adding 1 Item."), - /*****embedded variable*****/ - "Adding " => _("Adding "), - " Items." => _(" Items."), + "Adding 1 Item" => _("Adding 1 Item"), + "Adding %s Items" => _("Adding %s Items"), "You can only add tracks to smart blocks." => _("You can only add tracks to smart blocks."), "You can only add tracks, smart blocks, and webstreams to playlists." => _("You can only add tracks, smart blocks, and webstreams to playlists."), //library/events/library_showbuilder.js - "Adding 1 Item." => _("Adding 1 Item."), - /****string with variable*****/ - "Adding " => _("Adding "), - " Items." => _(" Items."), + //already in library/events/library_playlistbuilder.js + //"Adding 1 Item" => _("Adding 1 Item"), + //"Adding %s Items" => _("Adding %s Items"), //library/library.js "Select" => _("Select"), "Select this page" => _("Select this page"), @@ -167,9 +164,7 @@ class LocaleController extends Zend_Controller_Action "Can not connect to the streaming server" => _("Can not connect to the streaming server"), "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." => _("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."), - /*****embedded variable*****/ - "For more details, please read the " => _("For more details, please read the "), - "Airtime manual" => _("Airtime manual"), + "For more details, please read the %sAirtime Manual%s" => _("For more details, please read the %sAirtime Manual%s"), "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." => _("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."), "Check this box to automatically switch off Master/Show source upon source disconnection." => _("Check this box to automatically switch off Master/Show source upon source disconnection."), @@ -279,10 +274,8 @@ class LocaleController extends Zend_Controller_Action //"Airtime is unsure about the status of this file. This can happen when the file is on a remote drive that is unaccessible or the file is in a directory that isn't 'watched' anymore." //=> _("Airtime is unsure about the status of this file. This can happen when the file is on a remote drive that is unaccessible or the file is in a directory that isn't 'watched' anymore."), "Cannot schedule outside a show." => _("Cannot schedule outside a show."), - /*****embedded variable*****/ - "Moving " => _("Moving "), - " Item." => _(" Item."), - " Items." => _(" Items."), + "Moving 1 Item" => _("Moving 1 Item"), + "Moving %s Items" => _("Moving %s Items"), //already in library/library.js //"Select" => _("Select"), "Select all" => _("Select all"), diff --git a/airtime_mvc/public/js/airtime/library/events/library_playlistbuilder.js b/airtime_mvc/public/js/airtime/library/events/library_playlistbuilder.js index ced6d852e..d25ad32c6 100644 --- a/airtime_mvc/public/js/airtime/library/events/library_playlistbuilder.js +++ b/airtime_mvc/public/js/airtime/library/events/library_playlistbuilder.js @@ -86,9 +86,9 @@ var AIRTIME = (function(AIRTIME) { } if (selected === 1) { - message = $.i18n._("Adding 1 Item."); + message = $.i18n._("Adding 1 Item"); } else { - message = $.i18n._("Adding ") + selected + $.i18n._(" Items."); + message = sprintf($.i18n._("Adding %s Items"), selected); } container = $('
').append( diff --git a/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js b/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js index a0d5b4598..b0ab1b042 100644 --- a/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js +++ b/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js @@ -66,9 +66,9 @@ var AIRTIME = (function(AIRTIME) { } if (selected === 1) { - message = $.i18n._("Adding 1 Item."); + message = $.i18n._("Adding 1 Item"); } else { - message = $.i18n._("Adding ") + selected + $.i18n._(" Items."); + message = sprintf($.i18n._("Adding %s Items"), selected); } container = $('
').attr('id', diff --git a/airtime_mvc/public/js/airtime/preferences/streamsetting.js b/airtime_mvc/public/js/airtime/preferences/streamsetting.js index 1362fb456..5c1734772 100644 --- a/airtime_mvc/public/js/airtime/preferences/streamsetting.js +++ b/airtime_mvc/public/js/airtime/preferences/streamsetting.js @@ -251,7 +251,8 @@ function setupEventListeners() { $(".override_help_icon").qtip({ content: { 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 ")+""+$.i18n._("Airtime manual")+"." + sprintf($.i18n._( + "For more details, please read the %sAirtime Manual%s"), "", "") }, hide: { delay: 500, diff --git a/airtime_mvc/public/js/airtime/showbuilder/builder.js b/airtime_mvc/public/js/airtime/showbuilder/builder.js index e410ba739..7e3de9ac2 100644 --- a/airtime_mvc/public/js/airtime/showbuilder/builder.js +++ b/airtime_mvc/public/js/airtime/showbuilder/builder.js @@ -932,10 +932,10 @@ var AIRTIME = (function(AIRTIME){ } if (selected.length === 1) { - message = $.i18n._("Moving ")+selected.length+$.i18n._(" Item."); + message = $.i18n._("Moving 1 Item"); } else { - message = $.i18n._("Moving ")+selected.length+$.i18n._(" Items."); + message = sprintf($.i18n._("Moving %s Items"), selected.length); } draggingContainer = $('')