Angular translate incluido, Componentes core traducibles

This commit is contained in:
Juan Ferrer Toribio 2016-12-15 13:57:45 +01:00
parent 58d8176a42
commit 2920f7acda
21 changed files with 44 additions and 33 deletions

View File

@ -3,6 +3,7 @@ import {bootstrap} from './bootstrap';
import * as spliting from './spliting'; import * as spliting from './spliting';
import * as routes from './configroutes'; import * as routes from './configroutes';
import * as run from './run'; import * as run from './run';
import * as configNgTranslate from './translate';
import * as components from './components'; import * as components from './components';
import title from './styles/title.css' import title from './styles/title.css'

View File

@ -14,5 +14,4 @@ export const bootstrap = () => {
throw new Error("element is not defined"); throw new Error("element is not defined");
} }
ng.bootstrap(_element, [SALIX]); ng.bootstrap(_element, [SALIX]);
}; };

View File

@ -2,7 +2,6 @@ import * as core from 'core';
import * as spliting from './spliting'; import * as spliting from './spliting';
import * as deps from './spliting/deps.json'; import * as deps from './spliting/deps.json';
function loader(module) { function loader(module) {
function load($ocLazyLoad, $q){ function load($ocLazyLoad, $q){
return $q((resolve) => { return $q((resolve) => {

View File

@ -3,4 +3,4 @@ import * as core from 'core';
import {NAME as CORE} from 'core'; import {NAME as CORE} from 'core';
export const NAME = 'salix'; export const NAME = 'salix';
export const module = vendors.ng.module(NAME,[CORE]); export const module = vendors.ng.module(NAME, [CORE]);

View File

@ -1,10 +1,9 @@
import {ng} from 'vendor';
import {module} from './module'; import {module} from './module';
export const run = function($rootScope){ export const run = function($rootScope) {
$rootScope.$on('$viewContentLoaded',()=>{ $rootScope.$on('$viewContentLoaded',()=>{
componentHandler.upgradeAllRegistered(); componentHandler.upgradeAllRegistered();
}) })
} }
run.$inject=['$rootScope']; run.$inject = ['$rootScope'];
module.run(run); module.run(run);

View File

@ -0,0 +1,9 @@
import {module} from './module';
export const configNgTranslate = function($translateProvider) {
$translateProvider
.translations('es', {/* Traducciones */})
.preferredLanguage('es');
}
configNgTranslate.$inject = ['$translateProvider'];
module.config(configNgTranslate);

View File

@ -1,3 +1,3 @@
<button type = "*[typeName]*" class="*[className]*" *[enabled]* > <button type = "*[typeName]*" class="*[className]*" *[enabled]* translate>
*[label]* *[label]*
</button> </button>

View File

@ -1,4 +1,4 @@
<label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect"> <label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect">
<input type="checkbox" name="*[name]*" class="*[className]*" name="*[name]*" ng-model="*[model]*" rule="*[rule]*" *[enabled]* *[focus]*> <input type="checkbox" name="*[name]*" class="*[className]*" name="*[name]*" ng-model="*[model]*" rule="*[rule]*" *[enabled]* *[focus]*>
<span class="mdl-checkbox__label">*[label]*</span> <span class="mdl-checkbox__label" translate>*[label]*</span>
</label> </label>

View File

@ -1,5 +1,5 @@
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label"> <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<select class="mdl-textfield__input" class="*[className]*" name="*[name]*" ng-model="*[model]*" rule="*[rule]*" *[enabled]* ng-transclude> <select class="mdl-textfield__input" class="*[className]*" name="*[name]*" ng-model="*[model]*" rule="*[rule]*" *[enabled]* ng-transclude>
</select> </select>
<label class="mdl-textfield__label">*[label]*</label> <label class="mdl-textfield__label" translate>*[label]*</label>
</div> </div>

View File

@ -1,4 +1,4 @@
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label"> <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input *[className]*" type="text" name="*[name]*" ng-model="*[model]*" rule="*[rule]*" *[enabled]*> <input class="mdl-textfield__input *[className]*" type="text" name="*[name]*" ng-model="*[model]*" rule="*[rule]*" *[enabled]*>
<label class="mdl-textfield__label">*[label]*</label> <label class="mdl-textfield__label" translate>*[label]*</label>
</div> </div>

View File

@ -4,5 +4,3 @@ import {getModuleName,getVendorDependencies} from './util';
const DEPENDENCIES = getVendorDependencies(vendors) const DEPENDENCIES = getVendorDependencies(vendors)
export const NAME = getModuleName('core'); export const NAME = getModuleName('core');
export const module = vendors.ng.module(NAME,DEPENDENCIES); export const module = vendors.ng.module(NAME,DEPENDENCIES);

View File

@ -1,4 +1,4 @@
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label"> <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="*[className]*" type="password" name="*[name]*" ng-model="*[model]*" rule="*[rule]*" *[enabled]* *[focus]*> <input class="*[className]*" type="password" name="*[name]*" ng-model="*[model]*" rule="*[rule]*" *[enabled]* *[focus]*>
<label class="mdl-textfield__label">*[label]*</label> <label class="mdl-textfield__label" translate>*[label]*</label>
</div> </div>

View File

@ -1,2 +1,2 @@
<input type="radio" class="*[className]*" name="*[name]*" ng-model="*[model]*.*[name]*" *[enabled]*> <input type="radio" class="*[className]*" name="*[name]*" ng-model="*[model]*.*[name]*" *[enabled]*>
<span class="mdl-radio__label">*[text]*</span> <span class="mdl-radio__label" translate>*[text]*</span>

View File

@ -6,16 +6,16 @@ export const NAME = util.getProviderName ('RoutesLoader')
function $get($http){ function $get($http){
let script = document.currentScript || (() => { let script = document.currentScript || (() => {
let scripts = document.getElementsByTagName ('script'); let scripts = document.getElementsByTagName ('script');
return scripts[scripts.length - 1]; return scripts[scripts.length - 1];
}) (); }) ();
let routesCdn = script.getAttribute ('routes-cdn'); let routesCdn = script.getAttribute ('routes-cdn');
return $http
({ return $http({
method: 'GET', method: 'GET',
url: routesCdn url: routesCdn
}) });
} }
$get.$inject = ["$http"]; $get.$inject = ["$http"];
@ -25,4 +25,3 @@ export class RoutesLoader{ constructor () {} }
RoutesLoader.prototype.$get = $get; RoutesLoader.prototype.$get = $get;
var routes = new RoutesLoader (); var routes = new RoutesLoader ();
_module.provider (NAME, () => routes) _module.provider (NAME, () => routes)

View File

@ -4,7 +4,7 @@ export const NAME = 'vnRule';
export function directive() { export function directive() {
return { return {
restrict: 'A', restrict: 'A',
link: function (attrs, element){ link: function (attrs, element) {
} }
}; };
} }

View File

@ -1,2 +1,2 @@
<input type="submit" class="*[className]*" value="*[label]*" *[enabled]*> <input type="submit" class="*[className]*" translate-attr="{value: '*[label]*'}" value="*[label]*" *[enabled]*>
</input> </input>

View File

@ -1,4 +1,4 @@
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label"> <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="*[className]*" type="*[type]*" name="*[name]*" ng-model="*[model]*" rule="*[rule]*" *[enabled]* *[focus]*> <input class="*[className]*" type="*[type]*" name="*[name]*" ng-model="*[model]*" rule="*[rule]*" *[enabled]* *[focus]*>
<label class="mdl-textfield__label">*[label]*</label> <label class="mdl-textfield__label" translate>*[label]*</label>
</div> </div>

View File

@ -13,5 +13,5 @@
</form> </form>
</div> </div>
</div> </div>
<vn-snackbar id="snackbar"/></vn-snackbar> <vn-snackbar id="snackbar"></vn-snackbar>
</div> </div>

View File

@ -10,6 +10,7 @@
}, },
"dependencies": { "dependencies": {
"angular": "^1.5.8", "angular": "^1.5.8",
"angular-translate": "^2.13.1",
"angular-ui-router": "^1.0.0-beta.3", "angular-ui-router": "^1.0.0-beta.3",
"express": "^4.14.0", "express": "^4.14.0",
"material-design-lite": "^1.2.1", "material-design-lite": "^1.2.1",

View File

@ -0,0 +1,5 @@
import * as _ngTranslate from 'angular-translate';
export const ngTranslate = {
name: 'pascalprecht.translate'
};

View File

@ -1,4 +1,5 @@
export * from './angular-vendor'; export * from './angular-vendor';
export * from './oclazyload-vendor'; export * from './oclazyload-vendor';
export * from './uirouter-vendor'; export * from './uirouter-vendor';
export * from './angular-translate-vendor';
export * from './materialdesignlite-vendor'; export * from './materialdesignlite-vendor';