After logging in to localhost:8080, menu items are missing labels, due to language file not being found
I generated a new Cassandra project with latest JHipster application. I chose serbian language to be native and english to be the alternative language. When I try to login to the generated webapp on localhost:8080, the following error shows up in console:
GET http://localhost:8080/i18n/undefined.json?buildTimestamp=1524732583467 404 (Not Found)
Generate a new monolithic JHipster application with latest JHipster version, then choose two languages, setting one other than english as a native one. Run the backend and try to login to the generated webapp on localhost:8080. Check if menu items have labels and that console is free of 404 errors.
Hitting the browser refresh button, the language file gets served properly and the problem with the 404 console error disappears.
none
none
JHipster Generator v4.14.3
Monolithic application
Cassandra database
Hazelcast caching
Serbian (native) & english languages
This is what my yo-rc.json contents look like:
{
"generator-jhipster": {
"promptValues": {
"packageName": "com.package.cassandra",
"nativeLanguage": "sr"
},
"jhipsterVersion": "4.14.3",
"baseName": "cassandra",
"packageName": "com.package.cassandra",
"packageFolder": "com/package/cassandra",
"serverPort": "8080",
"authenticationType": "jwt",
"cacheProvider": "hazelcast",
"enableHibernateCache": false,
"websocket": false,
"databaseType": "cassandra",
"devDatabaseType": "cassandra",
"prodDatabaseType": "cassandra",
"searchEngine": false,
"messageBroker": false,
"serviceDiscoveryType": false,
"buildTool": "maven",
"enableSocialSignIn": false,
"enableSwaggerCodegen": false,
"jwtSecretKey": "4fb3ae16e32811df145c24357ec1f250a1a90fd2",
"clientFramework": "angularX",
"useSass": true,
"clientPackageManager": "yarn",
"applicationType": "monolith",
"testFrameworks": [],
"jhiPrefix": "jhi",
"enableTranslation": true,
"nativeLanguage": "sr",
"languages": [
"sr",
"en"
]
}
}
entityName.json files generated in the .jhipster directoryVarious entities
IOS HighSierra
Google Chrome
@micobarac please follow our issue template and fill in the output of jhipster info you say "Original configuration, no alterations" but you also say you choose serbian language etc, thats not the default so we cant help you without your config. Normally I would close such issues but i'm making an exception so that you could update the details
@deepu105, instead of closing issues, you should be more supportive, I guess. If I choose languages during JHipster project generation, I am not altering JHipster source code, I am just following the proposed template. So, I have an issue and it should be investigated. I updated the issue details and I hope that now I am compliant with your issue reporting procedure.
It looks like there is a problem with Angular app, when native language other than english is set, the app is not setting the language prefix, thus trying to get language file with undefined.json name.
GET http://localhost:8080/i18n/undefined.json?buildTimestamp=1524732583467 404 (Not Found)
I tried to reproduce the error, but I could not able. Everything works fine for me.
Check my jhipster info
Using JHipster version installed locally in current project's node_modules
Executing jhipster:info
Options:
##### **JHipster Version(s)**
[email protected] /Users/sierra/github/jh4313
└── [email protected]
##### **JHipster configuration, a `.yo-rc.json` file generated in the root folder**
<details>
<summary>.yo-rc.json file</summary>
<pre>
{
"generator-jhipster": {
"promptValues": {
"packageName": "com.company.myapp",
"nativeLanguage": "sr"
},
"jhipsterVersion": "4.14.3",
"baseName": "jh4313",
"packageName": "com.company.myapp",
"packageFolder": "com/company/myapp",
"serverPort": "8080",
"authenticationType": "jwt",
"cacheProvider": "hazelcast",
"enableHibernateCache": true,
"websocket": false,
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"prodDatabaseType": "postgresql",
"searchEngine": false,
"messageBroker": false,
"serviceDiscoveryType": false,
"buildTool": "maven",
"enableSocialSignIn": false,
"enableSwaggerCodegen": false,
"jwtSecretKey": "replaced-by-jhipster-info",
"clientFramework": "angularX",
"useSass": false,
"clientPackageManager": "yarn",
"applicationType": "monolith",
"testFrameworks": [],
"jhiPrefix": "jhi",
"enableTranslation": true,
"nativeLanguage": "sr",
"languages": [
"sr",
"en"
]
}
}
</pre>
</details>
##### **JDL for the Entity configuration(s) `entityName.json` files generated in the `.jhipster` directory**
<details>
<summary>JDL entity definitions</summary>
<pre>
</pre>
</details>
##### **Environment and Tools**
java version "1.8.0_162"
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)
git version 2.15.1 (Apple Git-101)
node: v8.11.1
npm: 5.8.0
yeoman: 2.0.2
yarn: 1.6.0
Docker version 18.03.0-ce, build 0520e24
docker-compose version 1.20.1, build 5d8c71b
Congratulations, JHipster execution is complete!
I cleared browser's cache but the problem remains.
@micobarac WE ARE DOING THIS FOR FREE IN OUR FREE TIME. So its really no fun trying to reproduce issues you face without knowing what exact options you used as there are thousands of combinations possible, and even one choice could make a difference. We have an Issue template and process for a reason and we expect you to follow it if you need our help. And being supportive doesn't mean we need to encourage users creating issues as they see fit. If you are using an OSS project you need to respect the rules and process of the project.
And its seems @pmverma couldn't reproduce the issue, so we need more info on how to reproduce it.
I appreciate your effort. You made really remarkable tool, and I am thankful for that.
Also, I'm sorry that you cannot reproduce the error. I see in your config file that you are using PostgreSQL, I am using Cassandra. The problem I encounter shows immediately after I login to generated frontend, as the app is trying to load undefined.json i18n file, instead of sr.json or en.json. Refresh makes the problem go away.
http://localhost:8080/i18n/undefined.json?buildTimestamp=1524813194036
I tried to debug, but I cannot figure out where this i18n loading mechanism happens. The only piece of code regarding this language loading mechanism I found is this one in node_modules/ng-jhipster/bundles/index.js:
function translatePartialLoader(http) {
return new __WEBPACK_IMPORTED_MODULE_4__ngx_translate_http_loader__["a" /* TranslateHttpLoader */](http, 'i18n/', ".json?buildTimestamp=" + process.env.BUILD_TIMESTAMP);
}
@micobarac do you now understand why we ask for those details? Please follow our guidelines next time so that people don't waste their time when trying to help you. This is annoying behaviour TBH
Yes, very anoying...
Why did you close the issue, is it solved for you?
I closed this issue because I cannot debug and you cannot reproduce, so, let's not waste any more time on this here.
All my steps to reproduce:
.yo-rc.json you provided in your 1st post2nd try :



I can reliably reproduce by refreshing while on the Swagger docs http://localhost:8080/#/admin/docs. It requests the default language, attempts to request an undefined language, then re-requests the default language. The only way to notice it happening is to see it in the dev console.

I'm sorry but this issue is a total mess... I can't reproduce it, it doesn't even compile as the .yo-rc.json uses an incorrect package name as @pascalgrimaud says.
OK @ruddell you are correct, but it's really to understand this when you read the original ticket! It's an issue with the admin module which doesn't get the correct language at some point
Fixed, thanks everyone :-)
Could you please tell us how you fixed the issue? Thanks.
Most helpful comment
@micobarac WE ARE DOING THIS FOR FREE IN OUR FREE TIME. So its really no fun trying to reproduce issues you face without knowing what exact options you used as there are thousands of combinations possible, and even one choice could make a difference. We have an Issue template and process for a reason and we expect you to follow it if you need our help. And being supportive doesn't mean we need to encourage users creating issues as they see fit. If you are using an OSS project you need to respect the rules and process of the project.
And its seems @pmverma couldn't reproduce the issue, so we need more info on how to reproduce it.