WIP: 4774-translationsVn #3138

Draft
carlossa wants to merge 7 commits from 4774-translationsVn into dev
12 changed files with 418 additions and 6 deletions

View File

@ -210,5 +210,26 @@
}, },
"MrwService": { "MrwService": {
"dataSource": "vn" "dataSource": "vn"
},
"CompanyI18n": {
"dataSource": "vn"
},
"ItemTypeI18n": {
"dataSource": "vn"
},
"InkI18n": {
"dataSource": "vn"
},
"OriginI18n": {
"dataSource": "vn"
},
"StateI18n": {
"dataSource": "vn"
},
"TagI18n": {
"dataSource": "vn"
},
"ItemCategoryI18n": {
"dataSource": "vn"
} }
} }

View File

@ -0,0 +1,26 @@
{
"name": "CompanyI18n",
"base": "VnModel",
"options": {
"mysql": {
"table": "companyI18n"
}
},
"properties": {
"id": {
"type": "number",
"id": true
},
"companyFk": {
"type": "number",
"id": 1
},
"lang": {
"type": "string",
"id": 2
},
"footnotes": {
"type": "string"
}
}
}

26
back/models/inkI18n.json Normal file
View File

@ -0,0 +1,26 @@
{
"name": "InkI18n",
"base": "VnModel",
"options": {
"mysql": {
"table": "inkI18n"
}
},
"properties": {
"id": {
"type": "number",
"id": true
},
"inkFk": {
"type": "number",
"id": 1
},
"lang": {
"type": "string",
"id": 2
},
"name": {
"type": "string"
}
}
}

View File

@ -0,0 +1,26 @@
{
"name": "ItemCategoryI18n",
"base": "VnModel",
"options": {
"mysql": {
"table": "itemCategoryI18n"
}
},
"properties": {
"id": {
"type": "number",
"id": true
},
"categoryFk": {
"type": "number",
"id": 1
},
"lang": {
"type": "string",
"id": 2
},
"name": {
"type": "string"
}
}
}

View File

@ -0,0 +1,27 @@
{
"name": "ItemTypeI18n",
"base": "VnModel",
"options": {
"mysql": {
"table": "itemTypeI18n"
}
},
"properties": {
"typeFk": {
"type": "number",
"id": 1
},
"lang": {
"type": "string",
"id": 2
},
"name": {
"type": "string"
},
"id": {
"type": "number",
"id": true
}
}
}

View File

@ -0,0 +1,26 @@
{
"name": "OriginI18n",
"base": "VnModel",
"options": {
"mysql": {
"table": "originI18n"
}
},
"properties": {
"id": {
"type": "number",
"id": true
},
"originFk": {
"type": "number",
"id": 1
},
"lang": {
"type": "string",
"id": 2
},
"name": {
"type": "string"
}
}
}

View File

@ -0,0 +1,26 @@
{
"name": "StateI18n",
"base": "VnModel",
"options": {
"mysql": {
"table": "stateI18n"
}
},
"properties": {
"id": {
"type": "number",
"id": true
},
"stateFk": {
"type": "number",
"id": 1
},
"lang": {
"type": "string",
"id": 2
},
"name": {
"type": "string"
}
}
}

26
back/models/tagI18n.json Normal file
View File

@ -0,0 +1,26 @@
{
"name": "TagI18n",
"base": "VnModel",
"options": {
"mysql": {
"table": "tagI18n"
}
},
"properties": {
"id": {
"type": "number",
"id": true
},
"tagFk": {
"type": "number",
"id": 1
},
"lang": {
"type": "string",
"id": 2
},
"name": {
"type": "string"
}
}
}

View File

@ -4029,3 +4029,139 @@ INSERT IGNORE INTO vn.saySimpleCountry (countryFk, channel)
INSERT IGNORE INTO vn.saySimpleConfig (url) INSERT IGNORE INTO vn.saySimpleConfig (url)
VALUES ('saysimle-url-mock'); VALUES ('saysimle-url-mock');
INSERT INTO vn.itemTypeI18n (typeFk, lang, name)
VALUES
(1, 'ca', 'Alstroemeria'),
(1, 'en', 'Alstroemeria'),
(1, 'fr', 'Alstroemeria'),
(1, 'pt', 'Alstroemeria'),
(2, 'ca', 'Anthurium'),
(2, 'en', 'Anthurium'),
(2, 'fr', 'Anthurium'),
(2, 'pt', 'Antúrios'),
(3, 'ca', 'Bulbs'),
(3, 'en', 'Bulbs'),
(3, 'fr', 'Bulbes'),
(3, 'pt', 'Bulbos'),
(4, 'ca', 'Cales'),
(4, 'en', 'Calla Lilies'),
(4, 'fr', 'Calas'),
(4, 'pt', 'Jarros (callas)'),
(5, 'ca', 'Clavell'),
(5, 'en', 'Carnation'),
(5, 'fr', 'Oeillet'),
(5, 'pt', 'Cravo'),
(6, 'ca', 'Crisantem'),
(6, 'en', 'Chrysanthemum'),
(6, 'fr', 'Chrysanthème'),
(6, 'pt', 'Margaridas'),
(7, 'ca', 'Rams Variats'),
(7, 'en', 'Mixed Bouquets'),
(7, 'fr', 'Bouquets divers'),
(7, 'pt', 'Bouquet Variados'),
(8, 'ca', 'Flor Variada'),
(8, 'en', 'Assorted Flowers'),
(8, 'fr', 'Fleurs varié'),
(8, 'pt', 'Flores Variadas'),
(9, 'ca', 'Crisantem Santa Dorotea'),
(9, 'en', 'Santa Dorotea Chrysanthemum'),
(9, 'fr', 'Chrysanthème Santa Dorotea'),
(9, 'pt', 'Crisântemo Santa Dorotea');
INSERT INTO vn.inkI18n (inkFk, lang, name)
VALUES
('?', 'ca', 'Sense especificar'),
('?', 'en', 'Unspecified'),
('?', 'fr', 'Indéterminé'),
('?', 'mn', 'тодорхойгүй'),
('?', 'pt', 'Não especificado'),
('2C', 'ca', '2 Colors'),
('2C', 'en', '2 Colour'),
('2C', 'fr', '2 Couleur'),
('2C', 'mn', '2 Өнгө'),
('2C', 'pt', '2 Cor'),
('A/M', 'ca', 'Groc / Marró'),
('A/M', 'en', 'Yellow / Brown'),
('A/M', 'fr', 'Yellow / Brown'),
('A/M', 'mn', 'Шар / Браун'),
('A/M', 'pt', 'Yellow / Brown'),
('A/N', 'ca', 'Groc / Taronja'),
('A/N', 'en', 'Yellow orange'),
('A/N', 'fr', 'Jaune / Orange'),
('A/N', 'mn', 'Шар / Улбар шар'),
('A/N', 'pt', 'Amarelo / Laranja');
INSERT INTO vn.itemCategoryI18n (categoryFk, lang, name)
VALUES
(1, 'ca', 'Flor'),
(1, 'en', 'Flower'),
(1, 'fr', 'Fleur'),
(1, 'mn', 'цэцэг'),
(1, 'pt', 'Flores'),
(2, 'ca', 'Planta'),
(2, 'en', 'Plant'),
(2, 'fr', 'Plante'),
(2, 'mn', 'станц'),
(2, 'pt', 'Plantas'),
(3, 'ca', 'Complements'),
(3, 'en', 'Accessories'),
(3, 'fr', 'Accessoires'),
(3, 'mn', 'Дагалдах хэрэгсэл'),
(3, 'pt', 'Acessórios'),
(4, 'ca', 'Artificial'),
(4, 'en', 'Artificial'),
(4, 'fr', 'Artificielle'),
(4, 'mn', 'Хиймэл'),
(4, 'pt', 'Artificial'),
(5, 'ca', 'Verds'),
(5, 'en', 'Green'),
(5, 'fr', 'Vert'),
(5, 'mn', 'ногоон'),
(5, 'pt', 'Verdes');
INSERT INTO vn.originI18n (originFk, lang, name)
VALUES
(1, 'ca', 'Chollolandia'),
(1, 'en', 'Chollolandia'),
(1, 'fr', 'Chollolandia'),
(1, 'mn', 'Chollolandia'),
(1, 'pt', 'Chollolandia'),
(2, 'ca', 'Alemanya'),
(2, 'en', 'Germany'),
(2, 'fr', 'Allemagne'),
(2, 'mn', 'Герман'),
(2, 'pt', 'Alemanha'),
(3, 'ca', 'Almeria'),
(3, 'en', 'Almeria'),
(3, 'fr', 'Almeria'),
(3, 'mn', 'Зугаа'),
(3, 'pt', 'Almeria'),
(4, 'ca', 'Austràlia'),
(4, 'en', 'Australia'),
(4, 'fr', 'Australie'),
(4, 'mn', 'Австрали'),
(4, 'pt', 'Austrália'),
(5, 'ca', 'canada'),
(5, 'en', 'Canada'),
(5, 'fr', 'Canada'),
(5, 'mn', 'Канад'),
(5, 'pt', 'Canadá');
INSERT INTO vn.stateI18n (stateFk, lang, name)
VALUES
(1, 'en', 'Fix'),
(1, 'es', 'Arreglar'),
(2, 'en', 'Free'),
(2, 'es', 'Libre'),
(3, 'en', 'OK'),
(3, 'es', 'OK'),
(4, 'en', 'Printed'),
(4, 'es', 'Impreso'),
(5, 'en', 'Preparation'),
(5, 'es', 'Preparación'),
(6, 'en', 'In Review'),
(6, 'es', 'En Revisión'),
(7, 'en', 'Unfinished'),
(7, 'es', 'Sin Acabar');

View File

@ -0,0 +1,32 @@
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES
('CompanyI18n','*','*','ALLOW','ROLE','employee'),
('ItemTypeI18n','*','*','ALLOW','ROLE','employee'),
('InkI18n','*','*','ALLOW','ROLE','employee'),
('OriginI18n','*','*','ALLOW','ROLE','employee'),
('StateI18n','*','*','ALLOW','ROLE','employee'),
('TagI18n','*','*','ALLOW','ROLE','employee'),
('itemCategoryI18n','*','*','ALLOW','ROLE','employee');
ALTER TABLE vn.companyI18n
ADD id INT AUTO_INCREMENT UNIQUE;
ALTER TABLE vn.inkI18n
ADD id INT AUTO_INCREMENT UNIQUE;
ALTER TABLE vn.itemCategoryI18n
ADD id INT AUTO_INCREMENT UNIQUE;
ALTER TABLE vn.itemTypeI18n
ADD id INT AUTO_INCREMENT UNIQUE;
ALTER TABLE vn.originI18n
ADD id INT AUTO_INCREMENT UNIQUE;
ALTER TABLE vn.stateI18n
ADD id INT AUTO_INCREMENT UNIQUE;
ALTER TABLE vn.tagI18n
ADD id INT AUTO_INCREMENT UNIQUE;

View File

@ -0,0 +1,39 @@
module.exports = Self => {
Self.remoteMethod('getI18nTables', {
description: 'Return tables with name end with i18n',
accessType: 'READ',
accepts: [],
returns: {
type: 'Array',
root: true
},
http: {
path: `/get-i18n-tables`,
verb: 'GET'
}
});
Self.getI18nTables = async() => {
const tables = await Self.rawSql(`
SELECT c.table_name tableName, c.column_name primaryKey
FROM information_schema.columns c
WHERE
c.table_name LIKE '%i18n'
AND c.COLUMN_KEY = 'PRI'
AND c.column_name <> 'id'
AND c.COLUMN_NAME <> 'lang'`);
const columns = await Self.rawSql(`
SELECT c.table_name tableName, c.column_name field
FROM information_schema.columns c
WHERE
c.table_name LIKE '%i18n'
AND c.COLUMN_KEY <> 'PRI'
AND c.column_name <> 'id'
`);
for (const column of columns)
tables.find(t => t.tableName == column.tableName).field = column.field;
return tables;
};
};

View File

@ -5,4 +5,5 @@ module.exports = function(Self) {
require('../methods/application/executeProc')(Self); require('../methods/application/executeProc')(Self);
require('../methods/application/executeFunc')(Self); require('../methods/application/executeFunc')(Self);
require('../methods/application/getEnumValues')(Self); require('../methods/application/getEnumValues')(Self);
require('../methods/application/getI18nTables')(Self);
}; };