From 311d7b9f531df5f82c394f1e64de29ef514111e5 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 17 Jun 2014 23:53:44 +0200 Subject: [PATCH] Add embedding locales in angular modules. --- .gitignore | 1 + app/coffee/modules/locales.coffee | 22 ++++++++++++++++++++++ gulpfile.coffee | 20 ++++++++++++-------- 3 files changed, 35 insertions(+), 8 deletions(-) create mode 100644 app/coffee/modules/locales.coffee diff --git a/.gitignore b/.gitignore index 6b0a9a17..a89dd2ba 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ node_modules/ app/vendor config/main.coffee bower_components +app/coffee/modules/locales/locale*.coffee diff --git a/app/coffee/modules/locales.coffee b/app/coffee/modules/locales.coffee new file mode 100644 index 00000000..c5f75116 --- /dev/null +++ b/app/coffee/modules/locales.coffee @@ -0,0 +1,22 @@ +### +# Copyright (C) 2014 Andrey Antukh +# Copyright (C) 2014 Jesús Espino Garcia +# Copyright (C) 2014 David Barragán Merino +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +# File: modules/locales.coffee +### + +module = angular.module("taigaLocales", []) diff --git a/gulpfile.coffee b/gulpfile.coffee index f3957bde..48b73721 100644 --- a/gulpfile.coffee +++ b/gulpfile.coffee @@ -32,6 +32,7 @@ paths = { sassMain: "app/styles/main.scss" css: "dist/styles/**/*.css" images: "app/images/**/*" + locales: "app/locales/**/*.json" coffee: ["app/coffee/app.coffee", "config/main.coffee", "app/coffee/*.coffee", @@ -51,7 +52,8 @@ vendorJsLibs = [ "app/vendor/angular/angular.js", "app/vendor/angular-route/angular-route.js", "app/vendor/angular-sanitize/angular-sanitize.js", - "app/vendor/angular-animate/angular-animate.js" + "app/vendor/angular-animate/angular-animate.js", + "app/vendor/i18next/i18next.js" ] @@ -128,14 +130,14 @@ gulp.task "jslibs", -> gulp.task "locales", -> gulp.src("app/locales/en/app.json") - .pipe(wrap("angular.module('locales.en', []).constant('locales.en', <%= contents %>);")) - .pipe(rename("locale.en.coffee")) - .pipe(gulp.dest("app/coffee/")) + .pipe(wrap("angular.module('taigaLocales').constant('localesEnglish', <%= contents %>);")) + .pipe(rename("localeEnglish.coffee")) + .pipe(gulp.dest("app/coffee/modules/locales")) - gulp.src("app/locales/es/app.json") - .pipe(wrap("angular.module('locales.es', []).constant('locales.es', <%= contents %>);")) - .pipe(rename("locale.es.coffee")) - .pipe(gulp.dest("app/coffee/")) + # gulp.src("app/locales/es/app.json") + # .pipe(wrap("angular.module('locales.es', []).constant('locales.es', <%= contents %>);")) + # .pipe(rename("locale.es.coffee")) + # .pipe(gulp.dest("app/coffee/")) ############################################################################## @@ -163,6 +165,7 @@ gulp.task "watch", -> gulp.watch(paths.jade, ["jade"]) gulp.watch(paths.appStyles, ["scss-lint", "sass", "css"]) gulp.watch(paths.coffee, ["coffee"]) + gulp.watch(paths.locales, ["locales"]) gulp.task "express", -> @@ -189,6 +192,7 @@ gulp.task "default", [ "sass", "css", "copy", + "locales", "coffee", "jslibs", "connect",