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

translations: add http translations support #183

Merged
merged 1 commit into from
May 26, 2020

Conversation

jma
Copy link
Contributor

@jma jma commented May 20, 2020

  • Removes customTranslations property.
  • Adds translationsURLs to provide a list of remote translations.
  • Changes the demo applications accordingly.
  • Simplifies the tests.

Co-Authored-by: Johnny Mariéthoz Johnny.Mariethoz@rero.ch

Used by:

Why are you opening this PR?

  • To allows a server to provide custom translations.

How to test?

  • Look at the application demo and see the translations configurations and if it is works.

Code review check list

  • Commit message template compliance.
  • Commit message without typos.
  • File names.
  • Functions names.
  • Functions docstrings.
  • Unnecessary commited files?
  • Extracted translations?

@jma jma force-pushed the maj-translations branch from 86c4f5c to cda44df Compare May 20, 2020 09:14
@jma jma marked this pull request as ready for review May 20, 2020 09:15
@jma jma requested a review from sebdeleze May 20, 2020 09:15
@jma jma force-pushed the maj-translations branch from cda44df to 2226958 Compare May 20, 2020 15:58
@jma jma requested review from iGormilhit, rerowep and zannkukai and removed request for iGormilhit and rerowep May 25, 2020 06:31
@jma jma requested a review from AoNoOokami May 25, 2020 08:51
Copy link

@AoNoOokami AoNoOokami left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally with both other PRs

// mock response after the xhr request, otherwise it will be undefined
http.expectOne('/assets/i18n/fr.json').flush({
search: 'Recherche avancée',
'does not exists': 'Existe pas'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A detail but: "N'existe pas" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a problem with simple quote. I will change 'does not exists' => 'not exists'


// new translations
translate.get('does not exists').subscribe((res: string) => {
expect(res).toEqual('Existe pas');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as previous comment

@jma jma force-pushed the maj-translations branch from 2226958 to d3f92ee Compare May 25, 2020 09:55
Copy link

@sebdeleze sebdeleze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 excellent!

Comment on lines 17 to 26
import { TranslateLoader as BaseTranslateLoader } from '@ngx-translate/core';
import { Observable, of } from 'rxjs';
import { Observable, of, forkJoin } from 'rxjs';
import { CoreConfigService } from '../core-config.service.js';
import { HttpClient } from '@angular/common/http';
import { catchError, map } from 'rxjs/operators';
import de from './i18n/de.json';
import en from './i18n/en.json';
import fr from './i18n/fr.json';
import it from './i18n/it.json';
import { Inject } from '@angular/core';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just sort imports

* Removes `customTranslations` property.
* Adds `translationsURLs` to provide a list of remote translations.
* Changes the demo applications accordingly.
* Simplifies the tests.

Co-Authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
Co-Authored-by: Sébastien Délèze <sebastien.deleze@rero.ch>
@jma jma force-pushed the maj-translations branch from d3f92ee to a197037 Compare May 26, 2020 06:57
@sebdeleze sebdeleze merged commit 14b4543 into rero:dev May 26, 2020
@jma jma deleted the maj-translations branch December 13, 2021 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants