Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add i18n client #121

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ module.exports = class extends AppGenerator {
validateJava() {},

customSettings() {
this.skipI18n = true;
this.skipI18n = false;
this.testFrameworks = [];
this.enableTranslation = false;
this.enableTranslation = true;
this.languages = ['fr'];
}
};

Expand Down
13 changes: 7 additions & 6 deletions generators/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@ module.exports = class extends ClientGenerator {
}

get default() {
const defaultPhaseFromJHipster = super._default();
const defaultNodeClientPhaseSteps = {
// disable languages
composeLanguages() {}
};
return Object.assign(defaultPhaseFromJHipster, defaultNodeClientPhaseSteps);
// const defaultPhaseFromJHipster = super._default();
// const defaultNodeClientPhaseSteps = {
// // disable languages
// composeLanguages() {}
// };
// return Object.assign(defaultPhaseFromJHipster, defaultNodeClientPhaseSteps);
return super._default();
}

get writing() {
Expand Down
9 changes: 9 additions & 0 deletions generators/languages/USAGE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Description:
Select languages from a list of available languages. The i18n files will be copied to the /webapp/i18n folder.

Example:
jhipster languages

This will create for each selected language:
/webapp/i18n/{lang}/global.json
/webapp/i18n/{lang}/home.json
This conversation was marked as resolved.
Show resolved Hide resolved
27 changes: 27 additions & 0 deletions generators/languages/files.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
function writeFiles(languages) {
const clientFiles = {
common: []
};
languages.forEach(language => {
clientFiles.common.push({
condition: generator => true,
templates: [
`src/main/webapp/i18n/${language}/global.json`,
{
file: `src/main/webapp/i18n/${language}/home.json`,
renameTo: () => `src/main/webapp/i18n/${language}/home.json`,
noEjs: true
}
]
});
});
return {
overrideFiles() {
this.writeFilesToDisk(clientFiles, this, false);
}
};
}

module.exports = {
writeFiles
};
54 changes: 54 additions & 0 deletions generators/languages/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/* eslint-disable consistent-return */
const chalk = require('chalk');
const LanguagesGenerator = require('generator-jhipster/generators/languages');
const writeFiles = require('./files').writeFiles;

module.exports = class extends LanguagesGenerator {
constructor(args, opts) {
super(args, { fromBlueprint: true, ...opts }); // fromBlueprint variable is important

const jhContext = (this.jhipsterContext = this.options.jhipsterContext);

if (!jhContext) {
this.error(`This is a JHipster blueprint and should be used only like ${chalk.yellow('jhipster --blueprint myown')}`);
}

this.configOptions = jhContext.configOptions || {};
}

get initializing() {
// Here we are not overriding this phase and hence its being handled by JHipster
return super._initializing();
}

get prompting() {
// Here we are not overriding this phase and hence its being handled by JHipster
return super._prompting();
}

get configuring() {
// Here we are not overriding this phase and hence its being handled by JHipster
return super._configuring();
}

get default() {
// Here we are not overriding this phase and hence its being handled by JHipster
return super._default();
}

get writing() {
const phaseFromJHipster = super._writing();
const myCustomPhaseSteps = writeFiles(this.languages);
return Object.assign(phaseFromJHipster, myCustomPhaseSteps);
}

get install() {
// Here we are not overriding this phase and hence its being handled by JHipster
return super._install();
}

get end() {
// Here we are not overriding this phase and hence its being handled by JHipster
return super._end();
}
};
163 changes: 163 additions & 0 deletions generators/languages/templates/src/main/webapp/i18n/al/global.json.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
<%#
Copyright 2013-2020 the original author or authors from the JHipster project.

This file is part of the JHipster project, see https://www.jhipster.tech/
for more information.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-%>
{
"global": {
"title": "<%= capitalizedBaseName %>",
"browsehappy": "Ju po përdorni një browser të <strong>vjetëruar</strong>. Ju lutem <a href=\"http://browsehappy.com/?locale=en\">përditësoni browserin tuan</a> për të përmirësuar eksperiencën tuaj.",
"menu": {
"home": "Kreu",
"jhipster-needle-menu-add-element": "NHipster will add additional menu entries here (do not translate!)",
"entities": {
"main": "Entitete",
"jhipster-needle-menu-add-entry": "NHipster will add additional entities here (do not translate!)"
},
"account": {
"main": "Konto",
"settings": "Mjedisi",
"password": "Fjalëkalimi",
"sessions": "Seancat",
"login": "Hyrje",
"logout": "Dalje",
"register": "Regjistrim"
},
"admin": {
"main": "Administrim",
<%_ if (applicationType === 'gateway') { _%>
"gateway": "Gateway",
<%_ } _%>
"userManagement": "Menaxhimi i përdoruesëve",
"tracker": "Gjurmimi i përdoruesëve",
"metrics": "Metrikat",
"health": "Shëndeti",
"configuration": "Konfigurimi",
"logs": "Logs",
<%_ if ((databaseType !== 'no' || authenticationType === 'uaa') && databaseType !== 'cassandra') { _%>
"audits": "Auditet",
<%_ } _%>
"apidocs": "API",
"database": "Database",
"jhipster-needle-menu-add-admin-element": "NHipster will add additional menu entries here (do not translate!)"
},
"language": "Gjuha"
},
"form": {
"username.label": "Përdoruesi",
"username.placeholder": "Përdoruesi juaj",
"currentpassword.label": "Fjalëkalimi aktual",
"currentpassword.placeholder": "Fjalëkalimi aktual",
"newpassword.label": "Fjalëkalimi i ri",
"newpassword.placeholder": "Fjalëkalimi i ri",
"confirmpassword.label": "Konfirmoni fjalëkalimin e ri",
"confirmpassword.placeholder": "Konfirmoni fjalëkalimin e ri",
"email.label": "E-mail",
"email.placeholder": "E-maili juaj"
},
"messages": {
"info": {
"authenticated": {
"prefix": "Në qoftë se dëshironi ",
"link": "futuni",
"suffix": ", ju mund të përdorni konton standarde:<br/>- Administrator (login=\"admin\" and password=\"admin\") <br/>- User (login=\"user\" and password=\"user\")."
},
"register": {
"noaccount": "A keni një ende konto?",
"link": "Regjistroni një konto të re"
}
},
"error": {
"dontmatch": "Fjalëkalimi dhe konfirmimi nuk përputhen!"
},
"validate": {
"newpassword": {
"required": "Kërkohet fjalëkalimi juaj.",
"minlength": "Fjalëkalimi juaj duhet të jetë të paktën 4 gërma.",
"maxlength": "Fjalëkalimi jauj nuk mund të jetë më i gjatë se 50 gërma.",
"strength": "Fuqia e fjalëkalimit:"
},
"confirmpassword": {
"required": "Kërkohet konfirmimi i fjalëkalimit tuaj.",
"minlength": "Konfirmimi i fjalëkalimit tuaj duhet të jetë të paktën 4 gërma.",
"maxlength": "Konfirmimi i fjalëkalimit tuaj nuk mund të jetë më i gjatë se 50 gërma."
},
"email": {
"required": "Kërkohet emaili juaj.",
"invalid": "Emali juaj nuk është i vlefshëm.",
"minlength": "Emaili juaj duhet të jetë të paktën 4 gërma.",
"maxlength": "Emaili jauj nuk mund të jetë më i gjatë se 50 gërma."
}
}
},
"field": {
"id": "ID"
},
"ribbon": {
"dev": "Zhvillim"
},
"item-count": "Duke treguar {{first}} - {{second}} nga {{total}} artikuj."
},
"entity": {
"action": {
"addblob": "Shto blob",
"addimage": "Shto foto",
"back": "Mbrapsht",
"cancel": "Anullo",
"delete": "Fshi",
"edit": "Përpuno",
"open": "Hap",
"save": "Ruaj",
"view": "Trego"
},
"detail": {
"field": "Fusha",
"value": "Vlera"
},
"delete": {
"title": "Konfirmoni veprimin e fshirjes"
},
"validation": {
"required": "Fusha është e domosdoshme.",
"minlength": "Kjo fushë duhet të jetë të paktën {{ min }} gërma.",
"maxlength": "Kjo fushë nuk mund të jetë më e gjatë se {{ max }} gërma.",
"min": "Kjo fushë duhet të jetë të paktën {{ min }}.",
"max": "Kjo fushë nuk mund të jetë më shumë se {{ max }}.",
"minbytes": "Kjo fushë duhet të jetë të paktën {{ min }} bytes.",
"maxbytes": "Kjo fushë nuk mund të jetë më shumë se {{ max }} bytes.",
"pattern": "Kjo fushë duhet të ndjeki modelin {{ pattern }}.",
"number": "Kjo fushë duhet të jetë një numër.",
"datetimelocal": "Kjo fushë duhet të jetë një datë dhe kohë.",
"patternLogin": "Kjo fushë mund të ketë vetëm gërma, numra dhe adresa e-mali."
}
},
"error": {
"internalServerError": "Gabim i brëndshëm në server",
"server.not.reachable": "Serveri nuk është i arritshëm",
"url.not.found": "Nuk u gjet",
"NotNull": "Fusha {{ fieldName }} nuk mund të jetë bosh!",
"Size": "Fusha {{ fieldName }} nuk i përmbush kërkesat për min/maks!",
"userexists": "Përdoruesi është marrë nga dikush tjetër!",
"emailexists": "Emaili është marrë nga dikush tjetër!",
"idexists": "Një {{ entityName }} i ri nuk mund të ketë të njëjtën ID",
"idnull": "ID e pavlefshme",
"file": {
"could.not.extract": "Could not extract file",
"not.image": "File was expected to be an image but was found to be \"{{ fileType }}\""
}
},
"footer": "Ky është rrjeshti fundit"
}
19 changes: 19 additions & 0 deletions generators/languages/templates/src/main/webapp/i18n/al/home.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"home": {
"title": "Mirëseerdhët në, Java Hipster!",
"subtitle": "Ky është kreu juaj",
"logged": {
"message": "Ju jeni futur si \"{{username}}\"."
},
"question": "Në qoftë se keni ndonjë pyetje rreth NHipster:",
"link": {
"homepage": "Kreu i NHipster",
"stackoverflow": "NHipster tek Stack Overflow",
"bugtracker": "NHipster bug tracker",
"chat": "NHipster dhoma e chatit publik",
"follow": "ndiq @NHipster në Twitter"
},
"like": "Në qoftë se ju pëlqen NHipster, mos harroni të na jepni një yll në",
"github": "GitHub"
}
}
Loading