Translations are missing with Angular and React.

Translations are missing on the front end.
Generate an application with Angular or React.
Main branch
{
"generator-jhipster": {
"blueprints": [],
"otherModules": [],
"applicationType": "monolith",
"reactive": false,
"baseName": "jhipster",
"jhipsterVersion": "6.10.5",
"skipClient": false,
"skipServer": false,
"skipUserManagement": true,
"skipCheckLengthOfIdentifier": false,
"skipFakeData": false,
"jhiPrefix": "jhi",
"entitySuffix": "",
"dtoSuffix": "DTO",
"clientPackageManager": "npm",
"testFrameworks": [],
"pages": [],
"creationTimestamp": 1605110559824,
"promptValues": {
"packageName": "com.mycompany.myapp",
"nativeLanguage": "fr"
},
"serviceDiscoveryType": false,
"authenticationType": "oauth2",
"packageName": "com.mycompany.myapp",
"serverPort": "8080",
"cacheProvider": "ehcache",
"enableHibernateCache": true,
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"prodDatabaseType": "postgresql",
"buildTool": "maven",
"serverSideOptions": [],
"websocket": false,
"searchEngine": false,
"messageBroker": false,
"enableSwaggerCodegen": false,
"clientFramework": "react",
"withAdminUi": true,
"clientTheme": "none",
"enableTranslation": true,
"nativeLanguage": "fr",
"packageFolder": "com/mycompany/myapp",
"clientThemeVariant": "",
"languages": ["fr", "en"]
}
}
Can confirm. I experienced this yesterday on my Twitch stream when using
the main branch.
On Wed, Nov 11, 2020 at 09:56 Quentin notifications@github.com wrote:
Overview of the issue
Traductions are missing with Angular and React.
[image: image]
https://user-images.githubusercontent.com/9989211/98840241-d84a7100-2446-11eb-8f5e-53bda9608d58.png
Motivation for or Use CaseTraductions are missing on the front end.
Reproduce the errorGenerate an application with Angular or React.
Related issues Suggest a Fix JHipster Version(s)Main branch
JHipster configuration{
"generator-jhipster": {
"blueprints": [],
"otherModules": [],
"applicationType": "monolith",
"reactive": false,
"baseName": "jhipster",
"jhipsterVersion": "6.10.5",
"skipClient": false,
"skipServer": false,
"skipUserManagement": true,
"skipCheckLengthOfIdentifier": false,
"skipFakeData": false,
"jhiPrefix": "jhi",
"entitySuffix": "",
"dtoSuffix": "DTO",
"clientPackageManager": "npm",
"testFrameworks": [],
"pages": [],
"creationTimestamp": 1605110559824,
"promptValues": {
"packageName": "com.mycompany.myapp",
"nativeLanguage": "fr"
},
"serviceDiscoveryType": false,
"authenticationType": "oauth2",
"packageName": "com.mycompany.myapp",
"serverPort": "8080",
"cacheProvider": "ehcache",
"enableHibernateCache": true,
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"prodDatabaseType": "postgresql",
"buildTool": "maven",
"serverSideOptions": [],
"websocket": false,
"searchEngine": false,
"messageBroker": false,
"enableSwaggerCodegen": false,
"clientFramework": "react",
"withAdminUi": true,
"clientTheme": "none",
"enableTranslation": true,
"nativeLanguage": "fr",
"packageFolder": "com/mycompany/myapp",
"clientThemeVariant": "",
"languages": ["fr", "en"]
}
}Browsers and Operating System
- Checking this box is mandatory (this is just to show you read
everything)—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/jhipster/generator-jhipster/issues/13025, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AAAELZAAJDCW52HXZ5XS3Y3SPK64TANCNFSM4TSHHHGA
.
Don't we have tests for that?
Don't we have tests for that?
We have a bunch of tests for that -> https://github.com/jhipster/generator-jhipster/blob/main/test/languages.spec.js
Maybe we do not cover each case.
If I try this command:
npx mocha --no-insight --forbid-only --parallel --grep languages
then I see couple of messages in the console:
yeoman-test: question languages was asked but answer was not provided
If I regenerate application after generation (jhipster --force) then this fixes translations. So it seems to be related to prompts.
This error occurs in one use case:
When executing languages stand alone it should just add another language.
So in this case when no language is selected at prompt, there is a bug that default value is set and the generator just ignores the new added language, supposing it was already added, because the language is already in the config.
If another native Language other than en, fr, is selected, the translation for that language is generated, but not English and French secondary languages.
I have the PR ready, updating it soon.
FYI just in case: I finished git bisect and found out that first bad commit according to this issue is: https://github.com/jhipster/generator-jhipster/commit/e7eb0c690544a1f11d22beeb20df58609ec08158
@kaidohallik I think this was temporary fixed because default language was undefined for some hours.
If you start again, probably you will trace back to the workflow refactoring.
Test case doesn’t cover this case.
I tested fix and now are translations available right after generation without need to regenerate, but noticed that if in native language choose default choice en and leave other languages empty then fr is automatically added to languages array:
"languages": ["en", "fr"]
Expected behaviour: languages array should contain only en if fr is not choosed.
@kaidohallik it defaults to fr selected like jdl, so you should deselect fr.
Probably that's not a good idea, I will revert that.
Most helpful comment
Can confirm. I experienced this yesterday on my Twitch stream when using
the main branch.
On Wed, Nov 11, 2020 at 09:56 Quentin notifications@github.com wrote: