1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-04 02:09:32 +02:00

- Refactoring supported languages.

This commit is contained in:
Gunther Brunner 2014-03-26 23:45:09 +09:00
parent 7037789251
commit b1089a631d
8 changed files with 113 additions and 51 deletions

View file

@ -29,7 +29,7 @@ gulp.task('jsonlint', function () {
gulp.task('lint', ['jshint', 'jsonlint']) gulp.task('lint', ['jshint', 'jsonlint'])
gulp.task('test', ['lint']) gulp.task('test', ['lint'])
gulp.task('build', ['webpack:build'], function () { gulp.task('build', ['translate', 'webpack:build'], function () {
}) })
// For production // For production
@ -61,65 +61,34 @@ gulp.task('translate', ['jade', 'translate:extract', 'translate:compile'],
function () { function () {
}) })
gulp.task('jade', function () { gulp.task('jade', function (callback) {
return gulp.src(['./res/**/*.jade', '!./res/bower_components/**']) gulp.src(['./res/**/*.jade', '!./res/bower_components/**'])
.pipe(jade()) .pipe(jade())
.pipe(gulp.dest('./tmp/html/')) .pipe(gulp.dest('./tmp/html/'))
callback()
}) })
gulp.task('translate:extract', function () { gulp.task('translate:extract', function (callback) {
//'./res/**/*.js' gulp.src(['./tmp/html/**/*.html', './res/**/*.js',
return gulp.src(['./tmp/html/**/*.html',
'!./res/bower_components/**']) '!./res/bower_components/**'])
.pipe(gettext.extract('stf.pot')) .pipe(gettext.extract('stf.pot'))
.pipe(gulp.dest('./res/common/lang/po/')) .pipe(gulp.dest('./res/common/lang/po/'))
callback()
}) })
gulp.task('translate:compile', function () { gulp.task('translate:compile', function (callback) {
return gulp.src('./res/common/lang/po/**/*.po') gulp.src('./res/common/lang/po/**/*.po')
.pipe(gettext.compile({ .pipe(gettext.compile({
format: 'json' format: 'json'
})) }))
.pipe(gulp.dest('./res/common/lang/translations/')) .pipe(gulp.dest('./res/common/lang/translations/'))
callback()
}) })
gulp.task('clean', function () { gulp.task('clean', function () {
gulp.src('./tmp', {read: false}) gulp.src('./tmp', {read: false})
.pipe(clean()) .pipe(clean())
}); })
// TODO: convert this to gulp
// 1. extract task: jade->html+js->pot
// 2. compile task: po->js
//grunt.initConfig({
// jade: {
// translate: {
// options: {
// data: {
// debug: false,
// files: {
// 'tmp/html/all.html': ['res/app/**/*.jade']
//
// }
// }
// }
// }
// },
//
// 'nggettext_extract': {
// pot: {
// files: {
// 'res/lang/po/template.pot': ['tmp/html/all.html', 'res/app/**/*.js']
// }
// }
// },
//
// 'nggettext_compile': {
// all: {
// files: {
// 'res/lang/translations.js': ['res/lang/po/*.po']
// }
// }
// }
//})

View file

@ -1,5 +1,9 @@
var _ = require('lodash') var _ = require('lodash')
// TODO: Implement this
var supportedLanguages = require('./../../../common/lang/langs.json')
module.exports = function LanguageServiceFactory( module.exports = function LanguageServiceFactory(
SettingsService SettingsService
, $q , $q

View file

@ -1,7 +1,13 @@
angular.module("gettext").run(['gettextCatalog', function (gettextCatalog) { angular.module('gettext').run(['gettextCatalog', function (gettextCatalog) {
gettextCatalog.setStrings('ja', require('./translations/stf.ja.json').ja ) // Load all supported languages
angular.forEach(require('./langs'), function (value, key) {
if (key !== 'en') {
gettextCatalog.setStrings(key,
require('./translations/stf.' + key + '.json')[key])
}
})
}]) }])
module.exports = angular.module('stf/lang', [ module.exports = angular.module('stf/lang', [
'gettext' 'gettext'
]) ])

View file

@ -0,0 +1,5 @@
{
"en": "English",
"es": "Espaniol",
"ja": "日本語"
}

View file

@ -14,7 +14,7 @@ msgstr ""
#: /Users/a12907/STF/stf/tmp/html/app/device-list/device-list.html #: /Users/a12907/STF/stf/tmp/html/app/device-list/device-list.html
msgid "Carrier" msgid "Carrier"
msgstr "" msgstr "キャリア"
#: /Users/a12907/STF/stf/tmp/html/app/components/stf/common-ui/clear-button/clear-button.html #: /Users/a12907/STF/stf/tmp/html/app/components/stf/common-ui/clear-button/clear-button.html
msgid "Clear" msgid "Clear"
@ -51,7 +51,7 @@ msgstr ""
#: /Users/a12907/STF/stf/tmp/html/app/menu/menu.html #: /Users/a12907/STF/stf/tmp/html/app/menu/menu.html
msgid "Help" msgid "Help"
msgstr "" msgstr "ヘルプ"
#: /Users/a12907/STF/stf/tmp/html/app/settings/language/language.html #: /Users/a12907/STF/stf/tmp/html/app/settings/language/language.html
msgid "Language" msgid "Language"

View file

@ -7,6 +7,18 @@ msgstr ""
msgid "" msgid ""
msgstr "" msgstr ""
#: /Users/a12907/STF/stf/res/app/device-list/device-list-controller.js
msgid "Absent"
msgstr ""
#: /Users/a12907/STF/stf/res/app/device-list/device-list-controller.js
msgid "Available"
msgstr ""
#: /Users/a12907/STF/stf/res/app/device-list/device-list-controller.js
msgid "Busy"
msgstr ""
#: /Users/a12907/STF/stf/tmp/html/app/device-list/device-list.html #: /Users/a12907/STF/stf/tmp/html/app/device-list/device-list.html
msgid "Carrier" msgid "Carrier"
msgstr "" msgstr ""
@ -15,6 +27,14 @@ msgstr ""
msgid "Clear" msgid "Clear"
msgstr "" msgstr ""
#: /Users/a12907/STF/stf/res/app/components/stf/socket/socket-state/socket-state-directive.js
msgid "Connected successfully."
msgstr ""
#: /Users/a12907/STF/stf/res/app/components/stf/socket/socket-state/socket-state-directive.js
msgid "Connecting..."
msgstr ""
#: /Users/a12907/STF/stf/tmp/html/app/menu/menu.html #: /Users/a12907/STF/stf/tmp/html/app/menu/menu.html
msgid "Control" msgid "Control"
msgstr "" msgstr ""
@ -32,10 +52,26 @@ msgstr ""
msgid "Devices" msgid "Devices"
msgstr "" msgstr ""
#: /Users/a12907/STF/stf/res/app/components/stf/socket/socket-state/socket-state-directive.js
msgid "Disconnected.<br />Socket connection was lost, try again reloading the page."
msgstr ""
#: /Users/a12907/STF/stf/tmp/html/app/settings/notifications/notifications.html #: /Users/a12907/STF/stf/tmp/html/app/settings/notifications/notifications.html
msgid "Enable notifications" msgid "Enable notifications"
msgstr "" msgstr ""
#: /Users/a12907/STF/stf/res/app/components/stf/socket/socket-state/socket-state-directive.js
msgid "Error while connecting."
msgstr ""
#: /Users/a12907/STF/stf/res/app/components/stf/socket/socket-state/socket-state-directive.js
msgid "Error while reconnecting."
msgstr ""
#: /Users/a12907/STF/stf/res/app/components/stf/socket/socket-state/socket-state-directive.js
msgid "Error."
msgstr ""
#: /Users/a12907/STF/stf/tmp/html/app/settings/settings.html #: /Users/a12907/STF/stf/tmp/html/app/settings/settings.html
msgid "Example: 3000" msgid "Example: 3000"
msgstr "" msgstr ""
@ -64,6 +100,10 @@ msgstr ""
msgid "Model" msgid "Model"
msgstr "" msgstr ""
#: /Users/a12907/STF/stf/res/app/device-list/device-list-controller.js
msgid "N/A"
msgstr ""
#: /Users/a12907/STF/stf/tmp/html/app/menu/menu.html #: /Users/a12907/STF/stf/tmp/html/app/menu/menu.html
msgid "Native" msgid "Native"
msgstr "" msgstr ""
@ -80,10 +120,34 @@ msgstr ""
msgid "OS" msgid "OS"
msgstr "" msgstr ""
#: /Users/a12907/STF/stf/res/app/device-list/device-list-controller.js
msgid "Offline"
msgstr ""
#: /Users/a12907/STF/stf/res/app/device-list/device-list-controller.js
msgid "Preparing"
msgstr ""
#: /Users/a12907/STF/stf/res/app/device-list/device-list-controller.js
msgid "Present"
msgstr ""
#: /Users/a12907/STF/stf/tmp/html/app/device-list/device-list.html #: /Users/a12907/STF/stf/tmp/html/app/device-list/device-list.html
msgid "Product" msgid "Product"
msgstr "" msgstr ""
#: /Users/a12907/STF/stf/res/app/device-list/device-list-controller.js
msgid "Ready"
msgstr ""
#: /Users/a12907/STF/stf/res/app/components/stf/socket/socket-state/socket-state-directive.js
msgid "Reconnected successfully."
msgstr ""
#: /Users/a12907/STF/stf/res/app/components/stf/socket/socket-state/socket-state-directive.js
msgid "Reconnecting..."
msgstr ""
#: /Users/a12907/STF/stf/tmp/html/app/components/stf/common-ui/refresh-page/refresh-page.html #: /Users/a12907/STF/stf/tmp/html/app/components/stf/common-ui/refresh-page/refresh-page.html
msgid "Refresh" msgid "Refresh"
msgstr "" msgstr ""
@ -136,7 +200,16 @@ msgstr ""
msgid "Target host (detect if blank)" msgid "Target host (detect if blank)"
msgstr "" msgstr ""
#: /Users/a12907/STF/stf/res/app/device-list/device-list-controller.js
msgid "Unauthorized"
msgstr ""
#: /Users/a12907/STF/stf/res/app/device-list/device-list-controller.js
msgid "Unknown"
msgstr ""
#: /Users/a12907/STF/stf/tmp/html/app/device-list/device-list.html #: /Users/a12907/STF/stf/tmp/html/app/device-list/device-list.html
#: /Users/a12907/STF/stf/res/app/device-list/device-list-controller.js
msgid "Use" msgid "Use"
msgstr "" msgstr ""
@ -144,6 +217,10 @@ msgstr ""
msgid "User" msgid "User"
msgstr "" msgstr ""
#: /Users/a12907/STF/stf/res/app/device-list/device-list-controller.js
msgid "Using"
msgstr ""
#: /Users/a12907/STF/stf/tmp/html/app/menu/menu.html #: /Users/a12907/STF/stf/tmp/html/app/menu/menu.html
msgid "Web" msgid "Web"
msgstr "" msgstr ""

View file

@ -0,0 +1 @@
{"es":{"Carrier":"Correa","Clear":"","Control":"","Details":"","Device Port":"","Devices":"","Enable notifications":"","Example: 3000":"","Filter":"","Help":"ヘルプ","Language":"","Local Settings":"","Location":"","Model":"","Native":"","No devices connected":"","Notifications":"","OS":"","Product":"","Refresh":"","Release Date":"","Reset Settings":"","Saved to: {{savedTo}}":"","Screen":"","Settings":"","Shell":"","Start Using":"","Status":"","Stop Using":"","Target IP / Hostname":"","Target Port":"","Target host (detect if blank)":"","Use":"","User":"","Web":""}}

View file

@ -1 +1 @@
{"ja":{"Carrier":"","Clear":"","Control":"","Details":"","Device Port":"","Devices":"","Enable notifications":"","Example: 3000":"","Filter":"","Help":"","Language":"","Local Settings":"","Location":"","Model":"","Native":"","No devices connected":"","Notifications":"","OS":"","Product":"","Refresh":"","Release Date":"","Reset Settings":"","Saved to: {{savedTo}}":"","Screen":"","Settings":"","Shell":"","Start Using":"","Status":"","Stop Using":"","Target IP / Hostname":"","Target Port":"","Target host (detect if blank)":"","Use":"","User":"","Web":""}} {"ja":{"Carrier":"キャリア","Clear":"","Control":"","Details":"","Device Port":"","Devices":"","Enable notifications":"","Example: 3000":"","Filter":"","Help":"ヘルプ","Language":"","Local Settings":"","Location":"","Model":"","Native":"","No devices connected":"","Notifications":"","OS":"","Product":"","Refresh":"","Release Date":"","Reset Settings":"","Saved to: {{savedTo}}":"","Screen":"","Settings":"","Shell":"","Start Using":"","Status":"","Stop Using":"","Target IP / Hostname":"","Target Port":"","Target host (detect if blank)":"","Use":"","User":"","Web":""}}