mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
fixing language issue
This commit is contained in:
parent
0e75fffc5f
commit
66b0b1afa8
@ -2,7 +2,6 @@ dist: trusty
|
|||||||
language: node_js
|
language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
- '10'
|
- '10'
|
||||||
- '11'
|
|
||||||
- '12'
|
- '12'
|
||||||
- '13'
|
- '13'
|
||||||
env:
|
env:
|
||||||
|
@ -54,7 +54,8 @@ unzip master.zip
|
|||||||
cd pigallery2-master # enter the unzipped directory
|
cd pigallery2-master # enter the unzipped directory
|
||||||
npm install
|
npm install
|
||||||
```
|
```
|
||||||
**Note**: if you run `npm run build-release`, it creates a clean, minified, production ready version from the app in the `release` folder, that is ready to deploy.
|
**Note**: if you run `npm run create-release`, it creates a clean, minified, production ready version from the app in the `release` folder, that is ready to deploy.
|
||||||
|
**Note**: you can use `npm run create-release -- --languages=fr,ro` to restrict building to the listed languages (english is added by default)
|
||||||
|
|
||||||
#### 1.1.2 Run PiGallery2
|
#### 1.1.2 Run PiGallery2
|
||||||
```bash
|
```bash
|
||||||
|
@ -125,7 +125,7 @@ export function translationsFactory(locale: string) {
|
|||||||
if (locale === 'en') {
|
if (locale === 'en') {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
return require(`raw-loader!../translate/messages.${locale}.xlf`);
|
return (<any>require(`raw-loader!../translate/messages.${locale}.xlf`)).default;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
22
gulpfile.ts
22
gulpfile.ts
@ -43,9 +43,25 @@ const getLanguages = () => {
|
|||||||
const files: string[] = dirCont.filter((elm) => {
|
const files: string[] = dirCont.filter((elm) => {
|
||||||
return elm.match(/.*\.[a-zA-Z]+\.(xlf)/ig);
|
return elm.match(/.*\.[a-zA-Z]+\.(xlf)/ig);
|
||||||
});
|
});
|
||||||
return files.map((f: string) => {
|
|
||||||
|
// get languages to filter
|
||||||
|
let languageFilter: string[] = null;
|
||||||
|
for (let i = 0; i < process.argv.length; i++) {
|
||||||
|
if (process.argv[i].startsWith('--languages=')) {
|
||||||
|
languageFilter = process.argv[i].replace('--languages=', '').split(',');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let languages = files.map((f: string) => {
|
||||||
return f.split('.')[1];
|
return f.split('.')[1];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (languageFilter !== null) {
|
||||||
|
languages = languages.filter((l) => {
|
||||||
|
return languageFilter.indexOf(l) !== -1;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return languages;
|
||||||
};
|
};
|
||||||
|
|
||||||
gulp.task('build-frontend', (() => {
|
gulp.task('build-frontend', (() => {
|
||||||
@ -98,11 +114,11 @@ gulp.task('zip-release', function () {
|
|||||||
.pipe(gulp.dest('.'));
|
.pipe(gulp.dest('.'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('build-release', gulp.series('build-frontend', 'build-backend', 'copy-static', 'copy-package', 'zip-release'));
|
gulp.task('create-release', gulp.series('build-frontend', 'build-backend', 'copy-static', 'copy-package', 'zip-release'));
|
||||||
|
|
||||||
|
|
||||||
const simpleBuild = (isProd: boolean) => {
|
const simpleBuild = (isProd: boolean) => {
|
||||||
const languages = getLanguages().filter(function (l) {
|
const languages = getLanguages().filter((l) => {
|
||||||
return l !== 'en';
|
return l !== 'en';
|
||||||
});
|
});
|
||||||
const tasks = [];
|
const tasks = [];
|
||||||
|
@ -8,8 +8,9 @@
|
|||||||
"main": "./backend/index.js",
|
"main": "./backend/index.js",
|
||||||
"bin": "./backend/index.js",
|
"bin": "./backend/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"install": "tsc && gulp build-prod",
|
"install": "npm run build-prod",
|
||||||
"build-release": "gulp build-release",
|
"build-prod": "tsc && gulp build-prod",
|
||||||
|
"create-release": "gulp build-release",
|
||||||
"build-backend": "tsc",
|
"build-backend": "tsc",
|
||||||
"pretest": "tsc",
|
"pretest": "tsc",
|
||||||
"test": "ng test && mocha --recursive test/backend/unit && mocha --recursive test/backend/integration && mocha --recursive test/common/unit ",
|
"test": "ng test && mocha --recursive test/backend/unit && mocha --recursive test/backend/integration && mocha --recursive test/common/unit ",
|
||||||
|
Loading…
Reference in New Issue
Block a user