Add embedding locales in angular modules.

stable
Andrey Antukh 2014-06-17 23:53:44 +02:00
parent ffcaade413
commit 311d7b9f53
3 changed files with 35 additions and 8 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ node_modules/
app/vendor app/vendor
config/main.coffee config/main.coffee
bower_components bower_components
app/coffee/modules/locales/locale*.coffee

View File

@ -0,0 +1,22 @@
###
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino Garcia <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán Merino <bameda@dbarragan.com>
#
# 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 <http://www.gnu.org/licenses/>.
#
# File: modules/locales.coffee
###
module = angular.module("taigaLocales", [])

View File

@ -32,6 +32,7 @@ paths = {
sassMain: "app/styles/main.scss" sassMain: "app/styles/main.scss"
css: "dist/styles/**/*.css" css: "dist/styles/**/*.css"
images: "app/images/**/*" images: "app/images/**/*"
locales: "app/locales/**/*.json"
coffee: ["app/coffee/app.coffee", coffee: ["app/coffee/app.coffee",
"config/main.coffee", "config/main.coffee",
"app/coffee/*.coffee", "app/coffee/*.coffee",
@ -51,7 +52,8 @@ vendorJsLibs = [
"app/vendor/angular/angular.js", "app/vendor/angular/angular.js",
"app/vendor/angular-route/angular-route.js", "app/vendor/angular-route/angular-route.js",
"app/vendor/angular-sanitize/angular-sanitize.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.task "locales", ->
gulp.src("app/locales/en/app.json") gulp.src("app/locales/en/app.json")
.pipe(wrap("angular.module('locales.en', []).constant('locales.en', <%= contents %>);")) .pipe(wrap("angular.module('taigaLocales').constant('localesEnglish', <%= contents %>);"))
.pipe(rename("locale.en.coffee")) .pipe(rename("localeEnglish.coffee"))
.pipe(gulp.dest("app/coffee/")) .pipe(gulp.dest("app/coffee/modules/locales"))
gulp.src("app/locales/es/app.json") # gulp.src("app/locales/es/app.json")
.pipe(wrap("angular.module('locales.es', []).constant('locales.es', <%= contents %>);")) # .pipe(wrap("angular.module('locales.es', []).constant('locales.es', <%= contents %>);"))
.pipe(rename("locale.es.coffee")) # .pipe(rename("locale.es.coffee"))
.pipe(gulp.dest("app/coffee/")) # .pipe(gulp.dest("app/coffee/"))
############################################################################## ##############################################################################
@ -163,6 +165,7 @@ gulp.task "watch", ->
gulp.watch(paths.jade, ["jade"]) gulp.watch(paths.jade, ["jade"])
gulp.watch(paths.appStyles, ["scss-lint", "sass", "css"]) gulp.watch(paths.appStyles, ["scss-lint", "sass", "css"])
gulp.watch(paths.coffee, ["coffee"]) gulp.watch(paths.coffee, ["coffee"])
gulp.watch(paths.locales, ["locales"])
gulp.task "express", -> gulp.task "express", ->
@ -189,6 +192,7 @@ gulp.task "default", [
"sass", "sass",
"css", "css",
"copy", "copy",
"locales",
"coffee", "coffee",
"jslibs", "jslibs",
"connect", "connect",