diff --git a/src/i18n/zh-HanS/plugins/cordova-plugin-battery-status/sim-host-panels.html b/src/i18n/zh-Hans/plugins/cordova-plugin-battery-status/sim-host-panels.html similarity index 100% rename from src/i18n/zh-HanS/plugins/cordova-plugin-battery-status/sim-host-panels.html rename to src/i18n/zh-Hans/plugins/cordova-plugin-battery-status/sim-host-panels.html diff --git a/src/i18n/zh-HanS/plugins/cordova-plugin-camera/sim-host-dialogs.html b/src/i18n/zh-Hans/plugins/cordova-plugin-camera/sim-host-dialogs.html similarity index 100% rename from src/i18n/zh-HanS/plugins/cordova-plugin-camera/sim-host-dialogs.html rename to src/i18n/zh-Hans/plugins/cordova-plugin-camera/sim-host-dialogs.html diff --git a/src/i18n/zh-HanS/plugins/cordova-plugin-camera/sim-host-panels.html b/src/i18n/zh-Hans/plugins/cordova-plugin-camera/sim-host-panels.html similarity index 100% rename from src/i18n/zh-HanS/plugins/cordova-plugin-camera/sim-host-panels.html rename to src/i18n/zh-Hans/plugins/cordova-plugin-camera/sim-host-panels.html diff --git a/src/i18n/zh-HanS/plugins/cordova-plugin-device-motion/sim-host-panels.html b/src/i18n/zh-Hans/plugins/cordova-plugin-device-motion/sim-host-panels.html similarity index 100% rename from src/i18n/zh-HanS/plugins/cordova-plugin-device-motion/sim-host-panels.html rename to src/i18n/zh-Hans/plugins/cordova-plugin-device-motion/sim-host-panels.html diff --git a/src/i18n/zh-HanS/plugins/cordova-plugin-device-orientation/sim-host-panels.html b/src/i18n/zh-Hans/plugins/cordova-plugin-device-orientation/sim-host-panels.html similarity index 100% rename from src/i18n/zh-HanS/plugins/cordova-plugin-device-orientation/sim-host-panels.html rename to src/i18n/zh-Hans/plugins/cordova-plugin-device-orientation/sim-host-panels.html diff --git a/src/i18n/zh-HanS/plugins/cordova-plugin-device/sim-host-panels.html b/src/i18n/zh-Hans/plugins/cordova-plugin-device/sim-host-panels.html similarity index 100% rename from src/i18n/zh-HanS/plugins/cordova-plugin-device/sim-host-panels.html rename to src/i18n/zh-Hans/plugins/cordova-plugin-device/sim-host-panels.html diff --git a/src/i18n/zh-HanS/plugins/cordova-plugin-geolocation/sim-host-panels.html b/src/i18n/zh-Hans/plugins/cordova-plugin-geolocation/sim-host-panels.html similarity index 100% rename from src/i18n/zh-HanS/plugins/cordova-plugin-geolocation/sim-host-panels.html rename to src/i18n/zh-Hans/plugins/cordova-plugin-geolocation/sim-host-panels.html diff --git a/src/i18n/zh-HanS/plugins/cordova-plugin-globalization/sim-host-panels.html b/src/i18n/zh-Hans/plugins/cordova-plugin-globalization/sim-host-panels.html similarity index 100% rename from src/i18n/zh-HanS/plugins/cordova-plugin-globalization/sim-host-panels.html rename to src/i18n/zh-Hans/plugins/cordova-plugin-globalization/sim-host-panels.html diff --git a/src/i18n/zh-HanS/plugins/cordova-plugin-inappbrowser/sim-host-panels.html b/src/i18n/zh-Hans/plugins/cordova-plugin-inappbrowser/sim-host-panels.html similarity index 100% rename from src/i18n/zh-HanS/plugins/cordova-plugin-inappbrowser/sim-host-panels.html rename to src/i18n/zh-Hans/plugins/cordova-plugin-inappbrowser/sim-host-panels.html diff --git a/src/i18n/zh-HanS/plugins/cordova-plugin-network-information/sim-host-panels.html b/src/i18n/zh-Hans/plugins/cordova-plugin-network-information/sim-host-panels.html similarity index 100% rename from src/i18n/zh-HanS/plugins/cordova-plugin-network-information/sim-host-panels.html rename to src/i18n/zh-Hans/plugins/cordova-plugin-network-information/sim-host-panels.html diff --git a/src/i18n/zh-HanS/plugins/events/sim-host-panels.html b/src/i18n/zh-Hans/plugins/events/sim-host-panels.html similarity index 100% rename from src/i18n/zh-HanS/plugins/events/sim-host-panels.html rename to src/i18n/zh-Hans/plugins/events/sim-host-panels.html diff --git a/src/i18n/zh-HanS/plugins/exec/sim-host-dialogs.html b/src/i18n/zh-Hans/plugins/exec/sim-host-dialogs.html similarity index 100% rename from src/i18n/zh-HanS/plugins/exec/sim-host-dialogs.html rename to src/i18n/zh-Hans/plugins/exec/sim-host-dialogs.html diff --git a/src/i18n/zh-HanS/plugins/exec/sim-host-panels.html b/src/i18n/zh-Hans/plugins/exec/sim-host-panels.html similarity index 100% rename from src/i18n/zh-HanS/plugins/exec/sim-host-panels.html rename to src/i18n/zh-Hans/plugins/exec/sim-host-panels.html diff --git a/src/i18n/zh-HanT/plugins/cordova-plugin-battery-status/sim-host-panels.html b/src/i18n/zh-Hant/plugins/cordova-plugin-battery-status/sim-host-panels.html similarity index 100% rename from src/i18n/zh-HanT/plugins/cordova-plugin-battery-status/sim-host-panels.html rename to src/i18n/zh-Hant/plugins/cordova-plugin-battery-status/sim-host-panels.html diff --git a/src/i18n/zh-HanT/plugins/cordova-plugin-camera/sim-host-dialogs.html b/src/i18n/zh-Hant/plugins/cordova-plugin-camera/sim-host-dialogs.html similarity index 100% rename from src/i18n/zh-HanT/plugins/cordova-plugin-camera/sim-host-dialogs.html rename to src/i18n/zh-Hant/plugins/cordova-plugin-camera/sim-host-dialogs.html diff --git a/src/i18n/zh-HanT/plugins/cordova-plugin-camera/sim-host-panels.html b/src/i18n/zh-Hant/plugins/cordova-plugin-camera/sim-host-panels.html similarity index 100% rename from src/i18n/zh-HanT/plugins/cordova-plugin-camera/sim-host-panels.html rename to src/i18n/zh-Hant/plugins/cordova-plugin-camera/sim-host-panels.html diff --git a/src/i18n/zh-HanT/plugins/cordova-plugin-device-motion/sim-host-panels.html b/src/i18n/zh-Hant/plugins/cordova-plugin-device-motion/sim-host-panels.html similarity index 100% rename from src/i18n/zh-HanT/plugins/cordova-plugin-device-motion/sim-host-panels.html rename to src/i18n/zh-Hant/plugins/cordova-plugin-device-motion/sim-host-panels.html diff --git a/src/i18n/zh-HanT/plugins/cordova-plugin-device-orientation/sim-host-panels.html b/src/i18n/zh-Hant/plugins/cordova-plugin-device-orientation/sim-host-panels.html similarity index 100% rename from src/i18n/zh-HanT/plugins/cordova-plugin-device-orientation/sim-host-panels.html rename to src/i18n/zh-Hant/plugins/cordova-plugin-device-orientation/sim-host-panels.html diff --git a/src/i18n/zh-HanT/plugins/cordova-plugin-device/sim-host-panels.html b/src/i18n/zh-Hant/plugins/cordova-plugin-device/sim-host-panels.html similarity index 100% rename from src/i18n/zh-HanT/plugins/cordova-plugin-device/sim-host-panels.html rename to src/i18n/zh-Hant/plugins/cordova-plugin-device/sim-host-panels.html diff --git a/src/i18n/zh-HanT/plugins/cordova-plugin-geolocation/sim-host-panels.html b/src/i18n/zh-Hant/plugins/cordova-plugin-geolocation/sim-host-panels.html similarity index 100% rename from src/i18n/zh-HanT/plugins/cordova-plugin-geolocation/sim-host-panels.html rename to src/i18n/zh-Hant/plugins/cordova-plugin-geolocation/sim-host-panels.html diff --git a/src/i18n/zh-HanT/plugins/cordova-plugin-globalization/sim-host-panels.html b/src/i18n/zh-Hant/plugins/cordova-plugin-globalization/sim-host-panels.html similarity index 100% rename from src/i18n/zh-HanT/plugins/cordova-plugin-globalization/sim-host-panels.html rename to src/i18n/zh-Hant/plugins/cordova-plugin-globalization/sim-host-panels.html diff --git a/src/i18n/zh-HanT/plugins/cordova-plugin-inappbrowser/sim-host-panels.html b/src/i18n/zh-Hant/plugins/cordova-plugin-inappbrowser/sim-host-panels.html similarity index 100% rename from src/i18n/zh-HanT/plugins/cordova-plugin-inappbrowser/sim-host-panels.html rename to src/i18n/zh-Hant/plugins/cordova-plugin-inappbrowser/sim-host-panels.html diff --git a/src/i18n/zh-HanT/plugins/cordova-plugin-network-information/sim-host-panels.html b/src/i18n/zh-Hant/plugins/cordova-plugin-network-information/sim-host-panels.html similarity index 100% rename from src/i18n/zh-HanT/plugins/cordova-plugin-network-information/sim-host-panels.html rename to src/i18n/zh-Hant/plugins/cordova-plugin-network-information/sim-host-panels.html diff --git a/src/i18n/zh-HanT/plugins/events/sim-host-panels.html b/src/i18n/zh-Hant/plugins/events/sim-host-panels.html similarity index 100% rename from src/i18n/zh-HanT/plugins/events/sim-host-panels.html rename to src/i18n/zh-Hant/plugins/events/sim-host-panels.html diff --git a/src/i18n/zh-HanT/plugins/exec/sim-host-dialogs.html b/src/i18n/zh-Hant/plugins/exec/sim-host-dialogs.html similarity index 100% rename from src/i18n/zh-HanT/plugins/exec/sim-host-dialogs.html rename to src/i18n/zh-Hant/plugins/exec/sim-host-dialogs.html diff --git a/src/i18n/zh-HanT/plugins/exec/sim-host-panels.html b/src/i18n/zh-Hant/plugins/exec/sim-host-panels.html similarity index 100% rename from src/i18n/zh-HanT/plugins/exec/sim-host-panels.html rename to src/i18n/zh-Hant/plugins/exec/sim-host-panels.html diff --git a/src/server/simulator.js b/src/server/simulator.js index 9990591..2753038 100644 --- a/src/server/simulator.js +++ b/src/server/simulator.js @@ -228,7 +228,7 @@ function parseOptions(opts) { config.xhrProxy = opts.hasOwnProperty('corsproxy') ? !!opts.corsproxy : true; config.touchEvents = opts.hasOwnProperty('touchevents') ? !!opts.touchevents : true; - config.lang = opts.lang; + config.lang = normalizeLanguage(opts.lang); config.deviceInfo = device.getDeviceInfo(opts.platform, opts.device); opts.platform = config.deviceInfo.platform; @@ -236,4 +236,32 @@ function parseOptions(opts) { return config; } +function normalizeLanguage(lang) { + // Tries to find the best match for the provided language + + if (!lang) { + return null; + } + + lang = lang.toLowerCase(); + + // This list matches the case of the relevant directory names, which is important for systems with case sensitive + // file systems. + var supportedLangs = ['zh-Hans', 'zh-Hant', 'cs', 'de', 'es', 'fr', 'it', 'ja', 'ko', 'pl', 'pt', 'ru', 'tr']; + + // Look for exact match (case insensitive) + var idx = supportedLangs.map(function (lang) { + return lang.toLowerCase() + }).indexOf(lang); + + if (idx == -1) { + // That didn't match, so try to match just the language + idx = supportedLangs.map(function (lang) { + return lang.split('-')[0]; + }).indexOf(lang.split('-')[0]); + } + + return idx > -1 ? supportedLangs[idx] : null; +} + module.exports = Simulator; diff --git a/tools/i18n/update.js b/tools/i18n/update.js index 68763d3..8177ba6 100644 --- a/tools/i18n/update.js +++ b/tools/i18n/update.js @@ -20,7 +20,7 @@ var NEEDS_TRANSLATION = 'needs-translation'; var MACHINE_SUGGESTION = 'mt-suggestion'; var htmlparser2TreeAdapter = parse5.treeAdapters.htmlparser2; -var langs = ['zh-HanS', 'zh-HanT', 'cs', 'de', 'es', 'fr', 'it', 'ja', 'ko', 'pl', 'pt', 'ru', 'tr']; +var langs = ['zh-Hans', 'zh-Hant', 'cs', 'de', 'es', 'fr', 'it', 'ja', 'ko', 'pl', 'pt', 'ru', 'tr']; var htmlRootPath = path.resolve(__dirname, '../../src'); var htmlFiles = files.findFiles(path.join(htmlRootPath, 'plugins'), 'html'); diff --git a/tools/i18n/xliff/zh-HanS.xlf b/tools/i18n/xliff/zh-Hans.xlf similarity index 72% rename from tools/i18n/xliff/zh-HanS.xlf rename to tools/i18n/xliff/zh-Hans.xlf index 1c0e7ef..feab457 100644 --- a/tools/i18n/xliff/zh-HanS.xlf +++ b/tools/i18n/xliff/zh-Hans.xlf @@ -1,339 +1,339 @@ - + Battery Status - 电池状态 + 电池状态 Battery level - 电池电量水平 + 电池电量水平 Device plugged - 插入的设备 + 插入的设备 - + Camera: Choose Image - 摄像头︰ 选择图像 + 摄像头︰ 选择图像 Choose File - 选择文件 + 选择文件 Use Image - 使用图像 + 使用图像 Cancel - 取消 + 取消 - + Camera - 相机 + 相机 Prompt me for a file - 提示我输入文件 + 提示我输入文件 Use this file: - 使用此文件︰ + 使用此文件︰ Choose File - 选择文件 + 选择文件 - + Accelerometer - 加速度计 + 加速度计 Click and drag with the mouse to manipulate the device. <br> Hold the Shift key to modify 'alpha' - 单击并拖动鼠标来操作该设备。<br>按住 Shift 键来修改 '阿尔法' + 单击并拖动鼠标来操作该设备。<br>按住 Shift 键来修改 '阿尔法' Recorded Data - 记录的数据 + 记录的数据 Play - 戏剧 + 戏剧 - + Compass - 指南针 + 指南针 <em>Click and drag with the mouse to manipulate the device compass.</em> - <em>单击并拖动鼠标来操纵装置指南针。</em> + <em>单击并拖动鼠标来操纵装置指南针。</em> Heading (deg) - 标题 (deg) + 标题 (deg) - + Device - 设备 + 设备 Platform - 平台 + 平台 Device - 设备 + 设备 OS version - 操作系统版本 + 操作系统版本 Physical resolution - 物理分辨率 + 物理分辨率 Device pixel ratio - 设备像素比 + 设备像素比 Logical resolution (viewport size) - 逻辑的决议 (视口大小) + 逻辑的决议 (视口大小) Cordova version - 科尔多瓦版本 + 科尔多瓦版本 Model - 模型 + 模型 Manufacturer - 制造商 + 制造商 UUID - UUID + UUID Version - 版本 + 版本 Serial - 串行 + 串行 Virtual device - 虚拟设备 + 虚拟设备 - + Geolocation - 地理位置 + 地理位置 Zoom Level: - 缩放级别︰ + 缩放级别︰ Latitude - 纬度 + 纬度 Longitude - 经度 + 经度 Altitude (m) - 海拔高度 (米) + 海拔高度 (米) Accuracy (m) - 精度 (m) + 精度 (m) Altitude accuracy (m) - 高度测量精度 (m) + 高度测量精度 (m) Heading - 标题 + 标题 Speed (m/s) - 速度 (m/s) + 速度 (m/s) GPS Delay (seconds) - GPS 的延迟 (秒) + GPS 的延迟 (秒) Simulate GPS Timeout - 模拟 GPS 超时 + 模拟 GPS 超时 Navigation Simulator - 航海模拟器 + 航海模拟器 Choose File - 选择文件 + 选择文件 Go - + - + Globalization - 全球化 + 全球化 Select the locale: - 选择的区域设置︰ + 选择的区域设置︰ Is daylight saving time - 是夏令时 + 是夏令时 Select the first day of the week: - 选择一周的第一天︰ + 选择一周的第一天︰ - + InAppBrowser - InAppBrowser + InAppBrowser Select the default behaviour of InAppBrowser when opening using the <em>_blank</em> target - 当打开使用 <em>_blank</em> 目标选择 InAppBrowser 的默认行为 + 当打开使用 <em>_blank</em> 目标选择 InAppBrowser 的默认行为 Open in a new window: <em>_system</em> target - 在新窗口中打开︰ <em>_system</em> 目标 + 在新窗口中打开︰ <em>_system</em> 目标 Open in a InAppBrowser based on an iframe - 在基于 iframe InAppBrowser 中打开 + 在基于 iframe InAppBrowser 中打开 - + Network Connection - 网络连接 + 网络连接 Connection type - 连接类型 + 连接类型 - + Events - 事件 + 事件 Select the event to fire: - 选择要触发的事件︰ + 选择要触发的事件︰ Fire Event - 火灾事件 + 火灾事件 - + Unhandled Exec Call - 未处理的 Exec 调用 + 未处理的 Exec 调用 There is no handler for the following exec call: - 没有以下的 exec 调用的处理程序︰ + 没有以下的 exec 调用的处理程序︰ service - 服务 + 服务 action - 行动 + 行动 Please enter a value below to be returned for this call, then indicate whether this represents success or failure. If you wish to always respond to this call with this result, select the 'persist' option. - 请输入下面返回此调用,然后指示是否这表示成功或失败的一个值。如果你想要总是响应这个召唤,这一结果,选择 '坚持' 选项。 + 请输入下面返回此调用,然后指示是否这表示成功或失败的一个值。如果你想要总是响应这个召唤,这一结果,选择 '坚持' 选项。 The value must be valid JSON ( - 值必须是有效的 JSON ( + 值必须是有效的 JSON ( error - 错误 + 错误 Persist - 坚持 + 坚持 Success - 成功 + 成功 Failure - 失败 + 失败 - + Persisted Exec Calls - 坚持 Exec 调用 + 坚持 Exec 调用 No values saved - 没有保存的值 + 没有保存的值 diff --git a/tools/i18n/xliff/zh-HanT.xlf b/tools/i18n/xliff/zh-Hant.xlf similarity index 72% rename from tools/i18n/xliff/zh-HanT.xlf rename to tools/i18n/xliff/zh-Hant.xlf index 3d927bc..9b44a7e 100644 --- a/tools/i18n/xliff/zh-HanT.xlf +++ b/tools/i18n/xliff/zh-Hant.xlf @@ -1,339 +1,339 @@ - + Battery Status - 電池狀態 + 電池狀態 Battery level - 電池計量水準 + 電池計量水準 Device plugged - 插入的設備 + 插入的設備 - + Camera: Choose Image - 攝像頭︰ 選擇圖像 + 攝像頭︰ 選擇圖像 Choose File - 選擇檔 + 選擇檔 Use Image - 使用圖像 + 使用圖像 Cancel - 取消 + 取消 - + Camera - 相機 + 相機 Prompt me for a file - 提示我輸入檔 + 提示我輸入檔 Use this file: - 使用此檔︰ + 使用此檔︰ Choose File - 選擇檔 + 選擇檔 - + Accelerometer - 加速度計 + 加速度計 Click and drag with the mouse to manipulate the device. <br> Hold the Shift key to modify 'alpha' - 按一下並拖動滑鼠來操作該設備。<br>按住 Shift 鍵來修改 '阿爾法' + 按一下並拖動滑鼠來操作該設備。<br>按住 Shift 鍵來修改 '阿爾法' Recorded Data - 記錄的資料 + 記錄的資料 Play - 戲劇 + 戲劇 - + Compass - 指南針 + 指南針 <em>Click and drag with the mouse to manipulate the device compass.</em> - <em>按一下並拖動滑鼠來操縱裝置指南針。</em> + <em>按一下並拖動滑鼠來操縱裝置指南針。</em> Heading (deg) - 標題 (deg) + 標題 (deg) - + Device - 設備 + 設備 Platform - 平臺 + 平臺 Device - 設備 + 設備 OS version - 作業系統版本 + 作業系統版本 Physical resolution - 物理解析度 + 物理解析度 Device pixel ratio - 設備圖元比 + 設備圖元比 Logical resolution (viewport size) - 邏輯的決議 (視口大小) + 邏輯的決議 (視口大小) Cordova version - 科爾多瓦版本 + 科爾多瓦版本 Model - 模型 + 模型 Manufacturer - 製造商 + 製造商 UUID - UUID + UUID Version - 版本 + 版本 Serial - 串列 + 串列 Virtual device - 虛擬裝置 + 虛擬裝置 - + Geolocation - 地理位置 + 地理位置 Zoom Level: - 縮放級別︰ + 縮放級別︰ Latitude - 緯度 + 緯度 Longitude - 經度 + 經度 Altitude (m) - 海拔高度 (米) + 海拔高度 (米) Accuracy (m) - 精度 (m) + 精度 (m) Altitude accuracy (m) - 高度測量精度 (m) + 高度測量精度 (m) Heading - 標題 + 標題 Speed (m/s) - 速度 (m/s) + 速度 (m/s) GPS Delay (seconds) - GPS 的延遲 (秒) + GPS 的延遲 (秒) Simulate GPS Timeout - 類比 GPS 超時 + 類比 GPS 超時 Navigation Simulator - 航海模擬器 + 航海模擬器 Choose File - 選擇檔 + 選擇檔 Go - + - + Globalization - 全球化 + 全球化 Select the locale: - 選擇的地區設定︰ + 選擇的地區設定︰ Is daylight saving time - 是夏令時 + 是夏令時 Select the first day of the week: - 選擇一周的第一天︰ + 選擇一周的第一天︰ - + InAppBrowser - InAppBrowser + InAppBrowser Select the default behaviour of InAppBrowser when opening using the <em>_blank</em> target - 當打開使用 <em>_blank</em> 目標選擇 InAppBrowser 的預設行為 + 當打開使用 <em>_blank</em> 目標選擇 InAppBrowser 的預設行為 Open in a new window: <em>_system</em> target - 在新視窗中打開︰ <em>_system</em> 目標 + 在新視窗中打開︰ <em>_system</em> 目標 Open in a InAppBrowser based on an iframe - 在基於 iframe InAppBrowser 中打開 + 在基於 iframe InAppBrowser 中打開 - + Network Connection - 網路連接 + 網路連接 Connection type - 連線類型 + 連線類型 - + Events - 事件 + 事件 Select the event to fire: - 選擇要觸發的事件︰ + 選擇要觸發的事件︰ Fire Event - 火災事件 + 火災事件 - + Unhandled Exec Call - 未處理的 Exec 調用 + 未處理的 Exec 調用 There is no handler for the following exec call: - 沒有以下的 exec 調用的處理常式︰ + 沒有以下的 exec 調用的處理常式︰ service - 服務 + 服務 action - 行動 + 行動 Please enter a value below to be returned for this call, then indicate whether this represents success or failure. If you wish to always respond to this call with this result, select the 'persist' option. - 請輸入下面返回此調用,然後指示是否這表示成功或失敗的一個值。如果你想要總是回應這個召喚,這一結果,選擇 '堅持' 選項。 + 請輸入下面返回此調用,然後指示是否這表示成功或失敗的一個值。如果你想要總是回應這個召喚,這一結果,選擇 '堅持' 選項。 The value must be valid JSON ( - 值必須是有效的 JSON ( + 值必須是有效的 JSON ( error - 錯誤 + 錯誤 Persist - 堅持 + 堅持 Success - 成功 + 成功 Failure - 失敗 + 失敗 - + Persisted Exec Calls - 堅持 Exec 調用 + 堅持 Exec 調用 No values saved - 沒有保存的值 + 沒有保存的值