diff --git a/omega-locales/cs/LC_MESSAGES/omega-web.po b/omega-locales/cs/LC_MESSAGES/omega-web.po index 565b281..b96f693 100644 --- a/omega-locales/cs/LC_MESSAGES/omega-web.po +++ b/omega-locales/cs/LC_MESSAGES/omega-web.po @@ -1027,8 +1027,8 @@ msgstr "SwitchyOmega:: $PROFILE$" msgid "browserAction_titleWithResult" msgstr "" -"SwitchyOmega:: $PROFILE$\n" -"$DETAILS$" +"SwitchyOmega:: $1:PROFILE$\n" +"$3:DETAILS$" msgid "browserAction_titleNewerOptions" msgstr "" diff --git a/omega-locales/en_US/LC_MESSAGES/omega-web.po b/omega-locales/en_US/LC_MESSAGES/omega-web.po index 0144f58..caffd3f 100644 --- a/omega-locales/en_US/LC_MESSAGES/omega-web.po +++ b/omega-locales/en_US/LC_MESSAGES/omega-web.po @@ -22,7 +22,7 @@ msgid "manifest_app_description" msgstr "Manage and switch between multiple proxies quickly & easily." msgid "manifest_icon_default_title" -msgstr "Loading..." +msgstr "Loading…" msgid "upgrade_profile_auto" msgstr "Auto Switch" @@ -44,7 +44,7 @@ msgstr "" "code> are specially treated only in Host wildcard conditions.
Example: <" "code>*.example.com will match www.example.com AND example.com as " "well.
To match subdomains only, use two asterisks like <" -"code>**.example.com" +"code>**.example.com." msgid "condition_HostRegexCondition" msgstr "Host regex" @@ -190,7 +190,7 @@ msgid "options_tab_importExport" msgstr "Import/Export" msgid "options_newProfile" -msgstr "New profile..." +msgstr "New profile…" msgid "options_apply" msgstr "Apply changes" @@ -491,7 +491,7 @@ msgid "options_bypassListHelp" msgstr "Servers for which you do not want to use any proxy: (One server on each line.)" msgid "options_bypassListHelpLinkText" -msgstr "(Wildcards and more available...)" +msgstr "(Wildcards and more available…)" msgid "options_group_pacUrl" msgstr "PAC URL" @@ -1016,8 +1016,8 @@ msgstr "SwitchyOmega:: $PROFILE$" msgid "browserAction_titleWithResult" msgstr "" -"SwitchyOmega:: $PROFILE$\n" -"$DETAILS$" +"SwitchyOmega:: $1:PROFILE$\n" +"$3:DETAILS$" msgid "browserAction_titleNewerOptions" msgstr "ERROR: A newer version of SwitchOmega is required to load the stored options." diff --git a/omega-locales/tr/LC_MESSAGES/omega-web.po b/omega-locales/tr/LC_MESSAGES/omega-web.po index c49f164..0f9650d 100644 --- a/omega-locales/tr/LC_MESSAGES/omega-web.po +++ b/omega-locales/tr/LC_MESSAGES/omega-web.po @@ -1032,8 +1032,8 @@ msgstr "SwitchyOmega:: $PROFILE$" msgid "browserAction_titleWithResult" msgstr "" -"SwitchyOmega:: $PROFILE$\n" -"$DETAILS$" +"SwitchyOmega:: $1:PROFILE$\n" +"$3:DETAILS$" msgid "browserAction_titleNewerOptions" msgstr "" diff --git a/omega-locales/zh_CN/LC_MESSAGES/omega-web.po b/omega-locales/zh_CN/LC_MESSAGES/omega-web.po index 5ba7085..5d4c9d5 100644 --- a/omega-locales/zh_CN/LC_MESSAGES/omega-web.po +++ b/omega-locales/zh_CN/LC_MESSAGES/omega-web.po @@ -897,8 +897,8 @@ msgstr "SwitchyOmega:: $PROFILE$" msgid "browserAction_titleWithResult" msgstr "" -"SwitchyOmega:: $PROFILE$\n" -"$DETAILS$" +"SwitchyOmega:: $1:PROFILE$\n" +"$3:DETAILS$" msgid "browserAction_titleNewerOptions" msgstr "错误:需要新版本的SwitchyOmega才能加载当前选项。" diff --git a/omega-locales/zh_TW/LC_MESSAGES/omega-web.po b/omega-locales/zh_TW/LC_MESSAGES/omega-web.po index 237df8a..4f3086a 100644 --- a/omega-locales/zh_TW/LC_MESSAGES/omega-web.po +++ b/omega-locales/zh_TW/LC_MESSAGES/omega-web.po @@ -897,8 +897,8 @@ msgstr "SwitchyOmega:: $PROFILE$" msgid "browserAction_titleWithResult" msgstr "" -"SwitchyOmega:: $PROFILE$\n" -"$DETAILS$" +"SwitchyOmega:: $1:PROFILE$\n" +"$3:DETAILS$" msgid "browserAction_titleNewerOptions" msgstr "錯誤:需要新版本的SwitchyOmega才能載入當前選項。" diff --git a/omega-target-chromium-extension/Gruntfile.coffee b/omega-target-chromium-extension/Gruntfile.coffee index 522b59e..914195d 100644 --- a/omega-target-chromium-extension/Gruntfile.coffee +++ b/omega-target-chromium-extension/Gruntfile.coffee @@ -1 +1,3 @@ -module.exports = require('load-grunt-config') +module.exports = (grunt) -> + require('load-grunt-config')(grunt) + require('./grunt-po2crx')(grunt) diff --git a/omega-target-chromium-extension/grunt-po2crx.coffee b/omega-target-chromium-extension/grunt-po2crx.coffee new file mode 100644 index 0000000..8ff4f19 --- /dev/null +++ b/omega-target-chromium-extension/grunt-po2crx.coffee @@ -0,0 +1,41 @@ +module.exports = (grunt) -> + taskDesc = 'Convert gettext PO files to Chromium Extension messages format.' + # coffeelint: disable=missing_fat_arrows + grunt.registerMultiTask 'po2crx', taskDesc, -> + for f in this.files + result = {} + for src in f.src + json = require('po2json').parseFileSync(src) + for own key, value of json when key + message = value[1] + refs = [] + matchCount = 0 + message = message.replace /\$(\d+:)?(\w+)\$/g, (_, order, ref) -> + matchCount++ + if order + order = parseInt(order) + else + order = matchCount + ### TODO(catus): Shall we enable this warning? + if matchCount > 1 + grunt.log.writeln("In this message: #{key}=#{message}") + grunt.log.writeln( + 'Order not specified for two or more refs in same message.') + ### + refs[order] = ref + return '$' + ref + '$' + + if not matchCount + placeholders = undefined + else + placeholders = {} + for i in [0...refs.length] + placeholder = refs[i] ? ('_unused_' + i) + placeholders[placeholder] = {content: '$' + i} + result[key] = + message: message + placeholders: placeholders + + grunt.file.write(f.dest, JSON.stringify(result)) + grunt.log.writeln("File \"#{f.dest}\" created.") + # coffeelint: enable=missing_fat_arrows diff --git a/omega-target-chromium-extension/grunt/aliases.coffee b/omega-target-chromium-extension/grunt/aliases.coffee index 31338a5..21938ba 100644 --- a/omega-target-chromium-extension/grunt/aliases.coffee +++ b/omega-target-chromium-extension/grunt/aliases.coffee @@ -4,6 +4,7 @@ module.exports = 'browserify' 'coffee' 'copy' + 'po2crx' ] test: ['mochaTest'] release: ['default', 'compress'] diff --git a/omega-target-chromium-extension/grunt/po2crx.coffee b/omega-target-chromium-extension/grunt/po2crx.coffee new file mode 100644 index 0000000..3e54cb4 --- /dev/null +++ b/omega-target-chromium-extension/grunt/po2crx.coffee @@ -0,0 +1,11 @@ +module.exports = + locales: + files: + 'build/_locales/en/messages.json': + '../omega-locales/en_US/LC_MESSAGES/omega-web.po' + 'build/_locales/zh/messages.json': + '../omega-locales/zh_CN/LC_MESSAGES/omega-web.po' + 'build/_locales/zh_CN/messages.json': + '../omega-locales/zh_CN/LC_MESSAGES/omega-web.po' + 'build/_locales/zh_TW/messages.json': + '../omega-locales/zh_TW/LC_MESSAGES/omega-web.po' diff --git a/omega-target-chromium-extension/grunt/watch.coffee b/omega-target-chromium-extension/grunt/watch.coffee index 41d9bea..06a73dc 100644 --- a/omega-target-chromium-extension/grunt/watch.coffee +++ b/omega-target-chromium-extension/grunt/watch.coffee @@ -5,12 +5,12 @@ module.exports = files: 'grunt/*' tasks: ['coffeelint:tasks', 'default'] + po2crx_locales: + files: ['../omega-locales/**/*'] + tasks: ['po2crx:locales'] copy_web: files: ['node_modules/omega-web/build/**/*'] tasks: ['copy:web'] - copy_i18n: - files: ['../omega-i18n/**/*'] - tasks: ['copy:i18n', 'copy:i18n_zh'] copy_target: files: ['node_modules/omega-target/omega_target.min.js'] tasks: ['copy:target'] diff --git a/omega-target-chromium-extension/package.json b/omega-target-chromium-extension/package.json index 0872d83..716824b 100644 --- a/omega-target-chromium-extension/package.json +++ b/omega-target-chromium-extension/package.json @@ -16,7 +16,8 @@ "grunt-contrib-watch": "^0.6.1", "grunt-mocha-test": "~0.11.0", "load-grunt-config": "^0.13.1", - "minifyify": "^4.1.1" + "minifyify": "^4.1.1", + "po2json": "^0.3.2" }, "dependencies": { "omega-target": "../omega-target",