mirror of
https://github.com/openstf/stf
synced 2025-10-04 02:09:32 +02:00
- Refactoring supported languages.
This commit is contained in:
parent
7037789251
commit
b1089a631d
8 changed files with 113 additions and 51 deletions
59
gulpfile.js
59
gulpfile.js
|
@ -29,7 +29,7 @@ gulp.task('jsonlint', function () {
|
|||
gulp.task('lint', ['jshint', 'jsonlint'])
|
||||
gulp.task('test', ['lint'])
|
||||
|
||||
gulp.task('build', ['webpack:build'], function () {
|
||||
gulp.task('build', ['translate', 'webpack:build'], function () {
|
||||
})
|
||||
|
||||
// For production
|
||||
|
@ -61,65 +61,34 @@ gulp.task('translate', ['jade', 'translate:extract', 'translate:compile'],
|
|||
function () {
|
||||
})
|
||||
|
||||
gulp.task('jade', function () {
|
||||
return gulp.src(['./res/**/*.jade', '!./res/bower_components/**'])
|
||||
gulp.task('jade', function (callback) {
|
||||
gulp.src(['./res/**/*.jade', '!./res/bower_components/**'])
|
||||
.pipe(jade())
|
||||
.pipe(gulp.dest('./tmp/html/'))
|
||||
|
||||
callback()
|
||||
})
|
||||
|
||||
gulp.task('translate:extract', function () {
|
||||
//'./res/**/*.js'
|
||||
return gulp.src(['./tmp/html/**/*.html',
|
||||
gulp.task('translate:extract', function (callback) {
|
||||
gulp.src(['./tmp/html/**/*.html', './res/**/*.js',
|
||||
'!./res/bower_components/**'])
|
||||
.pipe(gettext.extract('stf.pot'))
|
||||
.pipe(gulp.dest('./res/common/lang/po/'))
|
||||
|
||||
callback()
|
||||
})
|
||||
|
||||
gulp.task('translate:compile', function () {
|
||||
return gulp.src('./res/common/lang/po/**/*.po')
|
||||
gulp.task('translate:compile', function (callback) {
|
||||
gulp.src('./res/common/lang/po/**/*.po')
|
||||
.pipe(gettext.compile({
|
||||
format: 'json'
|
||||
}))
|
||||
.pipe(gulp.dest('./res/common/lang/translations/'))
|
||||
|
||||
callback()
|
||||
})
|
||||
|
||||
gulp.task('clean', function () {
|
||||
gulp.src('./tmp', {read: false})
|
||||
.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']
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//})
|
||||
})
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
var _ = require('lodash')
|
||||
|
||||
// TODO: Implement this
|
||||
var supportedLanguages = require('./../../../common/lang/langs.json')
|
||||
|
||||
|
||||
module.exports = function LanguageServiceFactory(
|
||||
SettingsService
|
||||
, $q
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
angular.module("gettext").run(['gettextCatalog', function (gettextCatalog) {
|
||||
gettextCatalog.setStrings('ja', require('./translations/stf.ja.json').ja )
|
||||
angular.module('gettext').run(['gettextCatalog', function (gettextCatalog) {
|
||||
// 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', [
|
||||
'gettext'
|
||||
])
|
||||
])
|
5
res/common/lang/langs.json
Normal file
5
res/common/lang/langs.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"en": "English",
|
||||
"es": "Espaniol",
|
||||
"ja": "日本語"
|
||||
}
|
|
@ -14,7 +14,7 @@ msgstr ""
|
|||
|
||||
#: /Users/a12907/STF/stf/tmp/html/app/device-list/device-list.html
|
||||
msgid "Carrier"
|
||||
msgstr ""
|
||||
msgstr "キャリア"
|
||||
|
||||
#: /Users/a12907/STF/stf/tmp/html/app/components/stf/common-ui/clear-button/clear-button.html
|
||||
msgid "Clear"
|
||||
|
@ -51,7 +51,7 @@ msgstr ""
|
|||
|
||||
#: /Users/a12907/STF/stf/tmp/html/app/menu/menu.html
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
msgstr "ヘルプ"
|
||||
|
||||
#: /Users/a12907/STF/stf/tmp/html/app/settings/language/language.html
|
||||
msgid "Language"
|
||||
|
|
|
@ -7,6 +7,18 @@ msgstr ""
|
|||
msgid ""
|
||||
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
|
||||
msgid "Carrier"
|
||||
msgstr ""
|
||||
|
@ -15,6 +27,14 @@ msgstr ""
|
|||
msgid "Clear"
|
||||
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
|
||||
msgid "Control"
|
||||
msgstr ""
|
||||
|
@ -32,10 +52,26 @@ msgstr ""
|
|||
msgid "Devices"
|
||||
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
|
||||
msgid "Enable notifications"
|
||||
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
|
||||
msgid "Example: 3000"
|
||||
msgstr ""
|
||||
|
@ -64,6 +100,10 @@ msgstr ""
|
|||
msgid "Model"
|
||||
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
|
||||
msgid "Native"
|
||||
msgstr ""
|
||||
|
@ -80,10 +120,34 @@ msgstr ""
|
|||
msgid "OS"
|
||||
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
|
||||
msgid "Product"
|
||||
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
|
||||
msgid "Refresh"
|
||||
msgstr ""
|
||||
|
@ -136,7 +200,16 @@ msgstr ""
|
|||
msgid "Target host (detect if blank)"
|
||||
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/res/app/device-list/device-list-controller.js
|
||||
msgid "Use"
|
||||
msgstr ""
|
||||
|
||||
|
@ -144,6 +217,10 @@ msgstr ""
|
|||
msgid "User"
|
||||
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
|
||||
msgid "Web"
|
||||
msgstr ""
|
||||
|
|
1
res/common/lang/translations/stf.es.json
Normal file
1
res/common/lang/translations/stf.es.json
Normal 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":""}}
|
|
@ -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":""}}
|
Loading…
Add table
Add a link
Reference in a new issue