Commit a5849afc authored by Dang Dien PHAN's avatar Dang Dien PHAN

Merge branch 'issue#2' into 'master'

#2: add grunt i18n and server i18n.

See merge request !6
parents 990959e7 1fcbe2f2
......@@ -78,7 +78,36 @@ module.exports = function(grunt) {
'frontend/**/*.pug'
]
}
},
i18n_checker: {
all: {
options: {
baseDir: __dirname,
dirs: [{
localeDir: 'backend/lib/i18n/locales',
templateSrc: [
'frontend/app/**/*.pug'
],
core: true
}],
verifyOptions: {
defaultLocale: 'en',
locales: ['en', 'fr', 'vi'],
rules: [
'all-keys-translated',
'all-locales-present',
'default-locale-translate',
'key-trimmed',
'no-duplicate-among-modules',
'no-duplicate-with-core',
'valid-json-file'
]
}
}
}
}
});
grunt.loadTasks('tasks');
......@@ -97,9 +126,11 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-wait-server');
grunt.loadNpmTasks('grunt-puglint');
grunt.loadNpmTasks('grunt-i18n-checker');
grunt.registerTask('pug-linter', 'Check the pug/jade files', ['puglint:all']);
grunt.registerTask('linters', 'Check code for lint', ['eslint:all', 'lint_pattern:all', 'lint_pattern:css', 'pug-linter']);
grunt.registerTask('linters', 'Check code for lint', ['eslint:all', 'lint_pattern:all', 'lint_pattern:css', 'pug-linter', 'i18n']);
grunt.registerTask('i18n', 'Check the translation files', ['i18n_checker']);
grunt.registerTask('linters-dev', 'Check changed files for lint', ['prepare-quick-lint', 'eslint:quick', 'lint_pattern:quick']);
grunt.registerTask('spawn-servers', 'spawn servers', ['shell:mongo', 'shell:redis']);
grunt.registerTask('kill-servers', 'kill servers', ['shell:mongo:kill', 'shell:redis:kill']);
......
'use strict';
module.exports = function(dependencies) {
const i18n = dependencies('i18n');
i18n.setDefaultConfiguration({ directory: __dirname + '/locales' });
return i18n;
};
{
"Seed module" : "Seed module",
"My sidebar" : "My sidebar"
}
{
"Seed module" : "Le module seed",
"My sidebar" : "Ma barre latérale"
}
{
"Seed module" : "Seed module",
"My sidebar" : "My sidebar"
}
......@@ -9,6 +9,7 @@ module.exports = function(dependencies) {
// Every express new configuration are appended here.
// This needs to be initialized before the body parser
require('./config/i18n')(dependencies, application);
require('./config/views')(dependencies, application);
return application;
......
'use strict';
module.exports = function(dependencies, application) {
var i18n = require('../../lib/i18n')(dependencies);
application.use(i18n.init);
};
......@@ -2,4 +2,4 @@ sub-header
seed-subheader
.seed-main-content
.seed-module-card
h1 {{ 'Seed module' | translate }}
h1 #{__('Seed module')}
.seed-sidebar-content
.card-header
h1 {{ 'My sidebar' | translate }}
h1 #{__('My sidebar')}
......@@ -3,6 +3,6 @@ extends /modules/subheader/responsive-subheader.pug
block left
seed-burger-button.hidden-md
span.seed-subheader-content
| {{ 'Seed Module' | translate }}
| #{__('Seed module')}
block right
......@@ -13,7 +13,8 @@ const myAwesomeModule = new AwesomeModule(MODULE_NAME, {
new Dependency(Dependency.TYPE_NAME, 'linagora.esn.core.logger', 'logger'),
new Dependency(Dependency.TYPE_NAME, 'linagora.esn.core.webserver.wrapper', 'webserver-wrapper'),
new Dependency(Dependency.TYPE_NAME, 'linagora.esn.core.db', 'db'),
new Dependency(Dependency.TYPE_NAME, 'linagora.esn.core.webserver.middleware.authorization', 'authorizationMW')
new Dependency(Dependency.TYPE_NAME, 'linagora.esn.core.webserver.middleware.authorization', 'authorizationMW'),
new Dependency(Dependency.TYPE_NAME, 'linagora.esn.core.i18n', 'i18n')
],
states: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment