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
|
||||
node_js:
|
||||
- '10'
|
||||
- '11'
|
||||
- '12'
|
||||
- '13'
|
||||
env:
|
||||
|
@ -54,7 +54,8 @@ unzip master.zip
|
||||
cd pigallery2-master # enter the unzipped directory
|
||||
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
|
||||
```bash
|
||||
|
@ -125,7 +125,7 @@ export function translationsFactory(locale: string) {
|
||||
if (locale === 'en') {
|
||||
return '';
|
||||
}
|
||||
return require(`raw-loader!../translate/messages.${locale}.xlf`);
|
||||
return (<any>require(`raw-loader!../translate/messages.${locale}.xlf`)).default;
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
|
22
gulpfile.ts
22
gulpfile.ts
@ -43,9 +43,25 @@ const getLanguages = () => {
|
||||
const files: string[] = dirCont.filter((elm) => {
|
||||
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];
|
||||
});
|
||||
|
||||
if (languageFilter !== null) {
|
||||
languages = languages.filter((l) => {
|
||||
return languageFilter.indexOf(l) !== -1;
|
||||
});
|
||||
}
|
||||
return languages;
|
||||
};
|
||||
|
||||
gulp.task('build-frontend', (() => {
|
||||
@ -98,11 +114,11 @@ gulp.task('zip-release', function () {
|
||||
.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 languages = getLanguages().filter(function (l) {
|
||||
const languages = getLanguages().filter((l) => {
|
||||
return l !== 'en';
|
||||
});
|
||||
const tasks = [];
|
||||
|
@ -8,8 +8,9 @@
|
||||
"main": "./backend/index.js",
|
||||
"bin": "./backend/index.js",
|
||||
"scripts": {
|
||||
"install": "tsc && gulp build-prod",
|
||||
"build-release": "gulp build-release",
|
||||
"install": "npm run build-prod",
|
||||
"build-prod": "tsc && gulp build-prod",
|
||||
"create-release": "gulp build-release",
|
||||
"build-backend": "tsc",
|
||||
"pretest": "tsc",
|
||||
"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