Skip to content

Commit

Permalink
translations: use server side translations
Browse files Browse the repository at this point in the history
* Adds new assets directory for the admin project.
* Moves translations files to the assets directories.
* Removes custom translations loader.
* Fixes bad translation string definition.
* Adds assets and backend translations URLs configurations.
* Removes useless manual translations.
* Fixes missing languages for translation extractions: ar, nl, es.

Co-Authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
  • Loading branch information
jma committed May 25, 2020
1 parent e3248a9 commit 64b86cd
Show file tree
Hide file tree
Showing 36 changed files with 210 additions and 727 deletions.
4 changes: 3 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
"polyfills": "projects/admin/src/polyfills.ts",
"tsConfig": "projects/admin/tsconfig.app.json",
"aot": false,
"assets": [],
"assets": [
"projects/admin/src/assets"
],
"styles": [
"node_modules/bootstrap/scss/bootstrap.scss",
"node_modules/ngx-bootstrap/datepicker/bs-datepicker.css",
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"admin_extract_messages": "ngx-translate-extract -k -c -s -i ./projects/admin/src -o ./projects/admin/src/app/translate/i18n/en_US.json --fi ' '",
"admin_update_catalog": "ngx-translate-extract -k -c -s -i ./projects/admin/src -o ./projects/admin/src/app/translate/i18n/{de,en,es,fr,it}.json --fi ' '",
"public-search_extract_messages": "ngx-translate-extract -k -c -s -i ./projects/public-search/src -o ./projects/public-search/src/app/translate/i18n/en_US.json --fi ' '",
"public-search_update_catalog": "ngx-translate-extract -k -c -s -i ./projects/public-search/src -o ./projects/public-search/src/app/translate/i18n/{de,en,fr,it}.json --fi ' '",
"admin_extract_messages": "ngx-translate-extract -k -c -s -i ./projects/admin/src -o ./projects/admin/src/assets/rero-ils-ui/admin/i18n/en_US.json --fi ' '",
"admin_update_catalog": "ngx-translate-extract -k -c -s -i ./projects/admin/src -o ./projects/admin/src/assets/rero-ils-ui/admin/i18n/{de,en,es,fr,it,nl,ar}.json --fi ' '",
"public-search_extract_messages": "ngx-translate-extract -k -c -s -i ./projects/public-search/src -o ./projects/public-search/src/assets/rero-ils-ui/public-search/i18n/en_US.json --fi ' '",
"public-search_update_catalog": "ngx-translate-extract -k -c -s -i ./projects/public-search/src -o ./projects/public-search/src/assets/rero-ils-ui/public-search/i18n/{de,en,es,fr,it,nl,ar}.json --fi ' '",
"extract_messages": "npm run public-search_extract_messages && npm run admin_extract_messages",
"update_catalog": "npm run public-search_update_catalog && npm run admin_update_catalog"
},
Expand Down
2 changes: 1 addition & 1 deletion projects/admin/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ import { RemoteAutocompleteInputTypeComponent } from './record/editor/remote-aut
import { ItemAvailabilityComponent } from './record/item-availability/item-availability.component';
import { AppConfigService } from './service/app-config.service';
import { SharedPipesModule } from './shared/shared-pipes.module';
import { TranslateLoader } from './translate/loader/translate-loader';
import { TranslateLoader } from '@rero/ng-core';
import { BsDatepickerModule } from 'ngx-bootstrap/datepicker';
import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
import { CollapseModule } from 'ngx-bootstrap/collapse';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class RemoteAutocompleteInputTypeComponent extends FieldType implements O
name: this.getNameSource(metadata[sourceName]),
ref: `https://mef.rero.ch/api/${sourceName}/${metadata[sourceName].pid}`,
query,
category: this.translateService.instant(`link to authority ${sourceName}`)
category: this.translateService.instant('link to authority ' + sourceName)
};
}

Expand Down
1 change: 1 addition & 0 deletions projects/admin/src/app/service/app-config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export class AppConfigService extends CoreConfigService {
this.defaultLanguage = environment.defaultLanguage;
this.adminRoles = environment.adminRoles;
this.sessionExpiredSeconds = environment.sessionExpiredSeconds;
this.translationsURLs = environment.translationsURLs;
}

public setSettings(settings: ContextSettings) {
Expand Down
25 changes: 0 additions & 25 deletions projects/admin/src/app/translate/loader/translate-loader.spec.ts

This file was deleted.

52 changes: 0 additions & 52 deletions projects/admin/src/app/translate/loader/translate-loader.ts

This file was deleted.

Loading

0 comments on commit 64b86cd

Please sign in to comment.