0
1
Fork 0
This commit is contained in:
Juan Ferrer Toribio 2016-09-27 08:18:20 +02:00
parent 1659c32fee
commit 99fc0f9615
34 changed files with 119 additions and 87 deletions

44
app.js
View File

@ -2,9 +2,51 @@
var Hedera = require ('hedera/hedera'); var Hedera = require ('hedera/hedera');
Vn.includeCss ('pages/main/style.css'); Vn.includeCss ('pages/main/style.css');
window.onload = function main () window.onload = function ()
{ {
Vn.Locale.init ();
var lang = Vn.Locale.language;
loadLocale (lang, main);
}
function main (req)
{
var keys = req.keys ();
for (var i = 0; i < keys.length; i++)
Vn.Locale.add (req (keys[i]));
hederaWeb = new Hedera.App (); hederaWeb = new Hedera.App ();
hederaWeb.run (); hederaWeb.run ();
} }
function loadLocale (lang, cb)
{
switch (lang)
{
case 'ca':
require.ensure ([], function (){
cb (require.context ('locale/ca/js')); });
break;
case 'es':
require.ensure ([], function () {
cb (require.context ('locale/es/js')); });
break;
case 'fr':
require.ensure ([], function () {
cb (require.context ('locale/fr/js')); });
break;
case 'mn':
require.ensure ([], function () {
cb (require.context ('locale/mn/js')); });
break;
case 'pt':
require.ensure ([], function () {
cb (require.context ('locale/pt/js')); });
break;
default:
require.ensure ([], function () {
cb (require.context ('locale/en/js')); });
}
}

View File

@ -61,7 +61,7 @@ Hedera.Catalog = new Class
else else
{ {
this.$('view-button').setProperties ({ this.$('view-button').setProperties ({
image: 'view-grid', icon: 'view-grid',
tip: _('Grid view') tip: _('Grid view')
}); });
this.view = Hedera.Catalog.View.LIST; this.view = Hedera.Catalog.View.LIST;

View File

@ -1,8 +1,6 @@
require ('sql/sql'); require ('sql/sql');
Vn.Locale.loadScript ('js/db.js');
Db = module.exports = { Db = module.exports = {
Connection : require ('./connection') Connection : require ('./connection')
,Result : require ('./result') ,Result : require ('./result')

View File

@ -2,7 +2,6 @@
require ('htk/htk'); require ('htk/htk');
Vn.includeCss ('js/hedera/style.css'); Vn.includeCss ('js/hedera/style.css');
Vn.Locale.loadScript ('js/hedera.js');
Hedera = module.exports = { Hedera = module.exports = {
Login : require ('./login') Login : require ('./login')

View File

@ -2,8 +2,6 @@
require ('db/db'); require ('db/db');
require ('./style.css'); require ('./style.css');
Vn.Locale.loadScript ('js/htk.js');
Htk = module.exports = { Htk = module.exports = {
Widget : require ('./widget') Widget : require ('./widget')
,Popup : require ('./popup') ,Popup : require ('./popup')

View File

@ -58,10 +58,10 @@ module.exports =
callback (success); callback (success);
} }
,add: function (strings) ,add: function (translations)
{ {
for (var stringId in strings) for (var str in translations)
vnLocaleStrings[stringId] = strings[stringId]; vnLocaleStrings[str] = translations[str];
} }
} }

View File

@ -415,5 +415,3 @@ Vn = module.exports = {
} }
}; };
Vn.Locale.loadScript ('js/vn.js');

View File

@ -1,8 +1,7 @@
Vn.Locale.add {
({
"ConnError": "Error en la conexió" "ConnError": "Error en la conexió"
,"BadServerReply": "Resposta del servidor incorrecta" ,"BadServerReply": "Resposta del servidor incorrecta"
,"ModelNotUpdatable": "Aquest model no és actualitzable" ,"ModelNotUpdatable": "Aquest model no és actualitzable"
,"RowNotExists": "El registre no existeix o ha sigut esborrat" ,"RowNotExists": "El registre no existeix o ha sigut esborrat"
,"ColNotExists": "La columna no existeix" ,"ColNotExists": "La columna no existeix"
}); }

View File

@ -1,5 +1,4 @@
Vn.Locale.add {
({
"User": "Usuari" "User": "Usuari"
,"Password": "Contrasenya" ,"Password": "Contrasenya"
,"Beta": "Beta" ,"Beta": "Beta"
@ -56,4 +55,4 @@ Vn.Locale.add
,"Configuration": "Configuració" ,"Configuration": "Configuració"
,"Account": "Compte" ,"Account": "Compte"
,"Addresses": "Direccions" ,"Addresses": "Direccions"
}); }

View File

@ -1,5 +1,4 @@
Vn.Locale.add {
({
"True": "Sí" "True": "Sí"
,"False": "No" ,"False": "No"
,"Null": "Nul" ,"Null": "Nul"
@ -28,4 +27,4 @@ Vn.Locale.add
,"Next": "Següent" ,"Next": "Següent"
,"Search": "Cercar" ,"Search": "Cercar"
,"Search...": "Cercar..." ,"Search...": "Cercar..."
}); }

View File

@ -1,5 +1,4 @@
Vn.Locale.add {
({
"Sunday": "Diumenge" "Sunday": "Diumenge"
,"Monday": "Dilluns" ,"Monday": "Dilluns"
,"Tuesday": "Dimarts" ,"Tuesday": "Dimarts"
@ -43,4 +42,4 @@ Vn.Locale.add
,"Dec": "Des" ,"Dec": "Des"
,"%A, %B %e": "%A, %e de %B" ,"%A, %B %e": "%A, %e de %B"
}); }

View File

@ -1,8 +1,7 @@
Vn.Locale.add {
({
"ConnError": "Connection failed" "ConnError": "Connection failed"
,"BadServerReply": "Bad server reply" ,"BadServerReply": "Bad server reply"
,"ModelNotUpdatable": "Model not updatable" ,"ModelNotUpdatable": "Model not updatable"
,"RowNotExists": "The record does not exist or has been deleted" ,"RowNotExists": "The record does not exist or has been deleted"
,"ColNotExists": "The column does not exist" ,"ColNotExists": "The column does not exist"
}); }

View File

@ -1,5 +1,4 @@
Vn.Locale.add {
({
"User": "User" "User": "User"
,"Password": "Password" ,"Password": "Password"
,"Beta": "Beta" ,"Beta": "Beta"
@ -56,4 +55,4 @@ Vn.Locale.add
,"Configuration": "Configuration" ,"Configuration": "Configuration"
,"Account": "Account" ,"Account": "Account"
,"Addresses": "Addresses" ,"Addresses": "Addresses"
}); }

View File

@ -1,5 +1,4 @@
Vn.Locale.add {
({
"True": "True" "True": "True"
,"False": "False" ,"False": "False"
,"Null": "Null" ,"Null": "Null"
@ -28,4 +27,4 @@ Vn.Locale.add
,"Next": "Next" ,"Next": "Next"
,"Search": "Search" ,"Search": "Search"
,"Search...": "Search..." ,"Search...": "Search..."
}); }

View File

@ -1,5 +1,4 @@
Vn.Locale.add {
({
"Sunday": "Sunday" "Sunday": "Sunday"
,"Monday": "Monday" ,"Monday": "Monday"
,"Tuesday": "Tuesday" ,"Tuesday": "Tuesday"
@ -43,4 +42,4 @@ Vn.Locale.add
,"Dec": "Dic" ,"Dec": "Dic"
,"%A, %B %e": "%A, %B %e" ,"%A, %B %e": "%A, %B %e"
}); }

View File

@ -1,8 +1,7 @@
Vn.Locale.add {
({
"ConnError": "Error en la conexión" "ConnError": "Error en la conexión"
,"BadServerReply": "Respuesta del servidor incorrecta" ,"BadServerReply": "Respuesta del servidor incorrecta"
,"ModelNotUpdatable": "Este modelo no es actualizable" ,"ModelNotUpdatable": "Este modelo no es actualizable"
,"RowNotExists": "El registro no existe o a sido borrado" ,"RowNotExists": "El registro no existe o a sido borrado"
,"ColNotExists": "La columna no existe" ,"ColNotExists": "La columna no existe"
}); }

View File

@ -1,5 +1,4 @@
Vn.Locale.add {
({
"User": "Usuario" "User": "Usuario"
,"Password": "Contraseña" ,"Password": "Contraseña"
,"Beta": "Beta" ,"Beta": "Beta"
@ -56,4 +55,4 @@ Vn.Locale.add
,"Configuration": "Configuración" ,"Configuration": "Configuración"
,"Account": "Cuenta" ,"Account": "Cuenta"
,"Addresses": "Direcciones" ,"Addresses": "Direcciones"
}); }

View File

@ -1,5 +1,4 @@
Vn.Locale.add {
({
"True": "Si" "True": "Si"
,"False": "No" ,"False": "No"
,"Null": "Nulo" ,"Null": "Nulo"
@ -28,4 +27,4 @@ Vn.Locale.add
,"Next": "Siguiente" ,"Next": "Siguiente"
,"Search": "Buscar" ,"Search": "Buscar"
,"Search...": "Buscar..." ,"Search...": "Buscar..."
}); }

View File

@ -1,5 +1,4 @@
Vn.Locale.add {
({
"Sunday": "Domingo" "Sunday": "Domingo"
,"Monday": "Lunes" ,"Monday": "Lunes"
,"Tuesday": "Martes" ,"Tuesday": "Martes"
@ -43,4 +42,4 @@ Vn.Locale.add
,"Dec": "Dic" ,"Dec": "Dic"
,"%A, %B %e": "%A, %e de %B" ,"%A, %B %e": "%A, %e de %B"
}); }

View File

@ -1,8 +1,7 @@
Vn.Locale.add {
({
"ConnError": "Échec de la connexion" "ConnError": "Échec de la connexion"
,"BadServerReply": "Réponse du serveur incorrecte" ,"BadServerReply": "Réponse du serveur incorrecte"
,"ModelNotUpdatable": "Ce modèle n'est pas modifiable" ,"ModelNotUpdatable": "Ce modèle n'est pas modifiable"
,"RowNotExists": "Le dossier n'existe pas ou a été supprimée" ,"RowNotExists": "Le dossier n'existe pas ou a été supprimée"
,"ColNotExists": "N'existe pas la colonne" ,"ColNotExists": "N'existe pas la colonne"
}); }

View File

@ -1,5 +1,4 @@
Vn.Locale.add {
({
"User": "Utilisateur" "User": "Utilisateur"
,"Password": "Mot de passe" ,"Password": "Mot de passe"
,"Beta": "Beta" ,"Beta": "Beta"
@ -56,4 +55,4 @@ Vn.Locale.add
,"Configuration": "Configuration" ,"Configuration": "Configuration"
,"Account": "Compte" ,"Account": "Compte"
,"Addresses": "Adresses" ,"Addresses": "Adresses"
}); }

View File

@ -1,5 +1,4 @@
Vn.Locale.add {
({
"True": "Si" "True": "Si"
,"False": "Aucun" ,"False": "Aucun"
,"Null": "Nul" ,"Null": "Nul"
@ -28,4 +27,4 @@ Vn.Locale.add
,"Next": "Suivant" ,"Next": "Suivant"
,"Search": "Recherche" ,"Search": "Recherche"
,"Search...": "Recherche..." ,"Search...": "Recherche..."
}); }

View File

@ -1,5 +1,4 @@
Vn.Locale.add {
({
"Sunday": "Dimanche" "Sunday": "Dimanche"
,"Monday": "Lundi" ,"Monday": "Lundi"
,"Tuesday": "Mardi" ,"Tuesday": "Mardi"
@ -43,4 +42,4 @@ Vn.Locale.add
,"Dec": "Déc" ,"Dec": "Déc"
,"%A, %B %e": "%A, %B %e" ,"%A, %B %e": "%A, %B %e"
}); }

View File

@ -1,8 +1,7 @@
Vn.Locale.add {
({
"ConnError": "Connection failed" "ConnError": "Connection failed"
,"BadServerReply": "Bad server reply" ,"BadServerReply": "Bad server reply"
,"ModelNotUpdatable": "Model not updatable" ,"ModelNotUpdatable": "Model not updatable"
,"RowNotExists": "The record does not exist or has been deleted" ,"RowNotExists": "The record does not exist or has been deleted"
,"ColNotExists": "The column does not exist" ,"ColNotExists": "The column does not exist"
}); }

View File

@ -1,5 +1,4 @@
Vn.Locale.add {
({
"User": "Хэрэглэгчийн" "User": "Хэрэглэгчийн"
,"Password": "нууц үг" ,"Password": "нууц үг"
,"Beta": "Бета" ,"Beta": "Бета"
@ -56,4 +55,4 @@ Vn.Locale.add
,"Configuration": "Тохиргоо" ,"Configuration": "Тохиргоо"
,"Account": "Дансны" ,"Account": "Дансны"
,"Addresses": "хаягууд" ,"Addresses": "хаягууд"
}); }

View File

@ -1,5 +1,4 @@
Vn.Locale.add {
({
"True": "True" "True": "True"
,"False": "False" ,"False": "False"
,"Null": "Null" ,"Null": "Null"
@ -28,4 +27,4 @@ Vn.Locale.add
,"Next": "Next" ,"Next": "Next"
,"Search": "хайх" ,"Search": "хайх"
,"Search...": "хайх..." ,"Search...": "хайх..."
}); }

View File

@ -1,5 +1,4 @@
Vn.Locale.add {
({
"Sunday": "Ням гараг" "Sunday": "Ням гараг"
,"Monday": "Даваа гариг" ,"Monday": "Даваа гариг"
,"Tuesday": "Мягмар" ,"Tuesday": "Мягмар"
@ -43,4 +42,4 @@ Vn.Locale.add
,"Dec": "Арв" ,"Dec": "Арв"
,"%A, %B %e": "%A, %B %e" ,"%A, %B %e": "%A, %B %e"
}); }

View File

@ -1,5 +1,5 @@
{ {
"Addresses": "Endereços "Addresses": "Endereços"
,"Return": "Voltar" ,"Return": "Voltar"
,"AddAddress": "Adicionar Endereço" ,"AddAddress": "Adicionar Endereço"

View File

@ -1,8 +1,7 @@
Vn.Locale.add {
({
"ConnError": "Erro de conexão" "ConnError": "Erro de conexão"
,"BadServerReply": "Resposta do servidor incorreta" ,"BadServerReply": "Resposta do servidor incorreta"
,"ModelNotUpdatable": "Este modelo não é actualizável" ,"ModelNotUpdatable": "Este modelo não é actualizável"
,"RowNotExists": "O Registro não existe ou foi apagado" ,"RowNotExists": "O Registro não existe ou foi apagado"
,"ColNotExists": "A Coluna não existe" ,"ColNotExists": "A Coluna não existe"
}); }

View File

@ -1,5 +1,4 @@
Vn.Locale.add {
({
"User": "Usuario" "User": "Usuario"
,"Password": "Palavra-Passe" ,"Password": "Palavra-Passe"
,"Beta": "Beta" ,"Beta": "Beta"
@ -56,4 +55,4 @@ Vn.Locale.add
,"Configuration": "Configuração" ,"Configuration": "Configuração"
,"Account": "Conta" ,"Account": "Conta"
,"Addresses": "Endereços" ,"Addresses": "Endereços"
}); }

View File

@ -1,5 +1,4 @@
Vn.Locale.add {
({
"True": "Sim" "True": "Sim"
,"False": "Não" ,"False": "Não"
,"Null": "Nulo" ,"Null": "Nulo"
@ -28,4 +27,4 @@ Vn.Locale.add
,"Next": "Seguinte" ,"Next": "Seguinte"
,"Search": "Procurar" ,"Search": "Procurar"
,"Search...": "Procurar..." ,"Search...": "Procurar..."
}); }

View File

@ -1,5 +1,4 @@
Vn.Locale.add {
({
"Sunday": "Domingo" "Sunday": "Domingo"
,"Monday": "Segunda-Feira" ,"Monday": "Segunda-Feira"
,"Tuesday": "Terça-Feira" ,"Tuesday": "Terça-Feira"
@ -43,4 +42,4 @@ Vn.Locale.add
,"Dec": "Dez" ,"Dec": "Dez"
,"%A, %B %e": "%A, %B %e" ,"%A, %B %e": "%A, %B %e"
}); }

View File

@ -5,6 +5,7 @@
"devDependencies": { "devDependencies": {
"webpack": "*", "webpack": "*",
"webpack-dev-server": "*", "webpack-dev-server": "*",
"split-by-name-webpack-plugin": "*",
"css-loader": "*", "css-loader": "*",
"style-loader": "*", "style-loader": "*",
"file-loader": "*", "file-loader": "*",

View File

@ -1,4 +1,5 @@
var fs = require ('fs');
var webpack = require ('webpack'); var webpack = require ('webpack');
module.exports = module.exports =
@ -24,7 +25,26 @@ module.exports =
fallback: process.env.NODE_PATH fallback: process.env.NODE_PATH
}, },
plugins: [ plugins: [
/*new webpack.optimize.UglifyJsPlugin ({minimize: true})*/ /* new webpack.IgnorePlugin (new RegExp ('.{2}/(forms|pages|rest)'))
] new webpack.optimize.UglifyJsPlugin ({minimize: true})
*/ ]
}; };
/*
var configs = [];
var langs = fs.readdirSync ('./locale');
for (var lang in languages)
configs.push (
{
entry: './locale.js',
output: {
path: __dirname +'/build',
filename: 'lang.'+ lang +'.js'
},
module: {
loaders: [
{ test: /\.json$/, loader: 'json' }
]
}
});
*/