Commit 6248ae0a061772c614153d7c4dc08a956d816f1f
1 parent
74e34a11
Exists in
master
and in
1 other branch
Improve build task to handle i18n
Showing
3 changed files
with
12 additions
and
3 deletions
Show diff stats
gulp/build.js
@@ -45,6 +45,9 @@ gulp.task('html', ['inject', 'partials'], function () { | @@ -45,6 +45,9 @@ gulp.task('html', ['inject', 'partials'], function () { | ||
45 | .pipe($.rev()) | 45 | .pipe($.rev()) |
46 | .pipe(jsFilter) | 46 | .pipe(jsFilter) |
47 | .pipe($.replace('assets/images/', noosferoThemePrefix + 'assets/images/')) | 47 | .pipe($.replace('assets/images/', noosferoThemePrefix + 'assets/images/')) |
48 | + .pipe($.replace('/languages/', noosferoThemePrefix + 'languages/')) | ||
49 | + .pipe($.replace('bower_components/angular-i18n/', noosferoThemePrefix + 'locale/angular-i18n/')) | ||
50 | + .pipe($.replace('bower_components/moment/', noosferoThemePrefix + 'locale/moment/')) | ||
48 | .pipe($.sourcemaps.init()) | 51 | .pipe($.sourcemaps.init()) |
49 | .pipe($.ngAnnotate()) | 52 | .pipe($.ngAnnotate()) |
50 | .pipe($.uglify({ preserveComments: $.uglifySaveLicense })).on('error', conf.errorHandler('Uglify')) | 53 | .pipe($.uglify({ preserveComments: $.uglifySaveLicense })).on('error', conf.errorHandler('Uglify')) |
@@ -81,6 +84,14 @@ gulp.task('fonts', function () { | @@ -81,6 +84,14 @@ gulp.task('fonts', function () { | ||
81 | .pipe(gulp.dest(path.join(conf.paths.dist, '/fonts/'))); | 84 | .pipe(gulp.dest(path.join(conf.paths.dist, '/fonts/'))); |
82 | }); | 85 | }); |
83 | 86 | ||
87 | +gulp.task('locale', function () { | ||
88 | + return gulp.src([ | ||
89 | + path.join("bower_components/angular-i18n", '*.js'), | ||
90 | + path.join("bower_components/moment/locale", '*.js'), | ||
91 | + ], {base: 'bower_components/'}) | ||
92 | + .pipe(gulp.dest(path.join(conf.paths.dist, '/locale/'))); | ||
93 | +}); | ||
94 | + | ||
84 | gulp.task('other', function () { | 95 | gulp.task('other', function () { |
85 | var fileFilter = $.filter(function (file) { | 96 | var fileFilter = $.filter(function (file) { |
86 | return file.stat.isFile(); | 97 | return file.stat.isFile(); |
@@ -98,4 +109,4 @@ gulp.task('clean', function () { | @@ -98,4 +109,4 @@ gulp.task('clean', function () { | ||
98 | return $.del([path.join(conf.paths.dist, '/'), path.join(conf.paths.tmp, '/')]); | 109 | return $.del([path.join(conf.paths.dist, '/'), path.join(conf.paths.tmp, '/')]); |
99 | }); | 110 | }); |
100 | 111 | ||
101 | -gulp.task('build', ['html', 'fonts', 'other']); | 112 | +gulp.task('build', ['html', 'fonts', 'other', 'locale']); |
src/app/components/language-selector/language-selector.component.ts
@@ -35,7 +35,6 @@ export class LanguageSelector { | @@ -35,7 +35,6 @@ export class LanguageSelector { | ||
35 | private changeMomentLocale(language: string) { | 35 | private changeMomentLocale(language: string) { |
36 | let localePromise = Promise.resolve(); | 36 | let localePromise = Promise.resolve(); |
37 | if (language != "en") { | 37 | if (language != "en") { |
38 | - // FIXME fix locale path | ||
39 | localePromise = this.angularLoad.loadScript(`/bower_components/moment/locale/${language}.js`); | 38 | localePromise = this.angularLoad.loadScript(`/bower_components/moment/locale/${language}.js`); |
40 | } | 39 | } |
41 | localePromise.then(() => { | 40 | localePromise.then(() => { |
src/app/index.config.ts
@@ -32,7 +32,6 @@ function configTranslation($translateProvider: angular.translate.ITranslateProvi | @@ -32,7 +32,6 @@ function configTranslation($translateProvider: angular.translate.ITranslateProvi | ||
32 | $translateProvider.useMissingTranslationHandlerLog(); | 32 | $translateProvider.useMissingTranslationHandlerLog(); |
33 | $translateProvider.preferredLanguage('en'); | 33 | $translateProvider.preferredLanguage('en'); |
34 | $translateProvider.useSanitizeValueStrategy('escape'); | 34 | $translateProvider.useSanitizeValueStrategy('escape'); |
35 | - //FIXME fix location pattern | ||
36 | tmhDynamicLocaleProvider.localeLocationPattern('bower_components/angular-i18n/angular-locale_{{locale}}.js'); | 35 | tmhDynamicLocaleProvider.localeLocationPattern('bower_components/angular-i18n/angular-locale_{{locale}}.js'); |
37 | tmhDynamicLocaleProvider.useCookieStorage(); | 36 | tmhDynamicLocaleProvider.useCookieStorage(); |
38 | } | 37 | } |