working example of directive for i18n new project button

This commit is contained in:
Henry Oswald 2014-07-30 15:05:13 +01:00
parent bdf1fed462
commit 1a8c3d17b2
5 changed files with 19 additions and 35 deletions

View file

@ -37,9 +37,9 @@ html(itemscope, itemtype='http://schema.org/Product')
script(src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js")
script(src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.14/angular.min.js")
script(src="/js/libs/i18next.js")
//- script(src="/js/libs/ng-i18next/provider.js")
//- script(src="/js/libs/ng-i18next/filter/filter.js")
//- script(src="/js/libs/ng-i18next/directive/directive.js")
script(src="/js/libs/ng-i18next/provider.js")
script(src="/js/libs/ng-i18next/filter/filter.js")
script(src="/js/libs/ng-i18next/directive/directive.js")
script.

View file

@ -18,17 +18,6 @@ block content
}
};
$.i18n.init({
lng: 'en-gb',
fallbackLng: 'en',
resGetPath: 'locales/__lng__.json'
}, function() {
console.log($.t('new_project')); // -> i18n (from en-US resourcefile)
});
.content.content-alt(ng-controller="ProjectPageController")
.container
.row

View file

@ -10,6 +10,7 @@ define [
"ng-context-menu"
"underscore"
"ngSanitize"
"jm.i18next"
])
return App

View file

@ -1,6 +1,19 @@
define [
"base"
], (App) ->
angular.module('jm.i18next').config ['$i18nextProvider', ($i18nextProvider)->
console.log("hello")
$i18nextProvider.options =
lng: 'en-GB',
useCookie: false,
useLocalStorage: false,
fallbackLng: 'en',
resGetPath: '/locales/__lng__.json'
]
App.factory "queuedHttp", ($http, $q) ->
pendingRequests = []
inflight = false
@ -48,7 +61,8 @@ define [
return queuedHttp
App.controller "ProjectPageController", ($scope, $modal, $q, $window, queuedHttp, event_tracking, $timeout) ->
App.controller "ProjectPageController", ($scope, $modal, $q, $window, queuedHttp, event_tracking, $timeout, $i18next) ->
console.log $i18next, $i18next("new_project"), "- NEW PROJECT"
$scope.projects = window.data.projects
$scope.tags = window.data.tags
$scope.allSelected = false

View file

@ -1,20 +0,0 @@
define [
], () ->
console.log "hello", angular.module('jm.i18next')
angular.module('jm.i18next').config ($i18nextProvider)->
console.log "hello 222"
$i18nextProvider.options = {
lng: 'en-GB',
useCookie: false,
useLocalStorage: false,
fallbackLng: 'dev',
resGetPath: '../locales/__lng__/__ns__.json',
defaultLoadingValue: '' # ng-i18next option, *NOT* directly supported by i18next
}
console.log "SUP"
console.log $i18nextProvider