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

In a React app without i18n support, texts disappear during the initial entity generation. #23939

Closed
1 task done
hide212131 opened this issue Oct 21, 2023 · 0 comments · Fixed by #23941
Closed
1 task done

Comments

@hide212131
Copy link
Contributor

Overview of the issue
$ jhipster
...
? Which *Framework* would you like to use for the client? React
? Would you like to enable internationalization support? (Y/n) No
...
$ jhipster jdl sample.jdl

Due to this, the text disappears.
disappeared

Upon regenerating, it appears.

$ jhipster
Motivation for or Use Case
Reproduce the error

See above.

Related issues
Suggest a Fix

The translateReactFilesTransform function, which disables the import, function, and tag of translation processing, is executed in get [BaseApplicationGenerator.WRITING](). However, it does not execute in get [BaseApplicationGenerator.WRITING_ENTITIES]().

In v8, when executing jhipster jdl, I assumed it would only structure the .jhipster directory. But now, it also generates code, similar to v7. I'm not sure which behavior is expected, but I believe it might be related.

I attempted to fix it by calling queueTranslateTransform from get [BaseApplicationGenerator.WRITING](), but it failed. The TranslationData did not store enough values, resulting in incorrect translations, like the labels of buttons not being translated.

(Analyzing the dependency of the execution generation order is challenging for me. I'd like to know a better way to understand it. 😭)

JHipster Version(s)

8.0.0-rc.1

JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "applicationType": "monolith",
    "authenticationType": "jwt",
    "baseName": "l10nReactApp",
    "buildTool": "maven",
    "cacheProvider": "ehcache",
    "clientFramework": "react",
    "clientTestFrameworks": [],
    "clientTheme": "none",
    "creationTimestamp": 1697869770560,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "devServerPort": 9060,
    "enableGradleEnterprise": null,
    "enableHibernateCache": true,
    "enableSwaggerCodegen": false,
    "enableTranslation": false,
    "entities": [
      "Region",
      "Country",
      "Location",
      "Department",
      "Task",
      "Employee",
      "Job",
      "JobHistory"
    ],
    "gradleEnterpriseHost": null,
    "jhipsterVersion": "8.0.0-rc.1",
    "lastLiquibaseTimestamp": 1697870250000,
    "messageBroker": false,
    "microfrontend": null,
    "microfrontends": [],
    "nativeLanguage": "en",
    "packageName": "com.mycompany.myapp",
    "prodDatabaseType": "postgresql",
    "reactive": false,
    "searchEngine": false,
    "serverPort": null,
    "serverSideOptions": [],
    "serviceDiscoveryType": false,
    "testFrameworks": [],
    "websocket": false,
    "withAdminUi": true
  }
}
Environment and Tools

openjdk version "17.0.8" 2023-07-18
OpenJDK Runtime Environment GraalVM CE 22.3.3 (build 17.0.8+7-jvmci-22.3-b22)
OpenJDK 64-Bit Server VM GraalVM CE 22.3.3 (build 17.0.8+7-jvmci-22.3-b22, mixed mode, sharing)

git version 2.39.3 (Apple Git-145)

node: v18.17.1
npm: 9.6.7

Docker version 24.0.6, build ed223bc

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
entity Region {
  regionName String
}
entity Country {
  countryName String
}
/**
 * not an ignored comment
 */
entity Location {
  streetAddress String
  postalCode String
  city String
  stateProvince String
}
entity Department {
  departmentName String required
}
/**
 * Task entity.\n@author The JHipster team.
 */
entity Task {
  title String
  description String
}
/**
 * The Employee entity.
 */
entity Employee {
  /**
   * The firstname attribute.
   */
  firstName String
  lastName String
  email String
  phoneNumber String
  hireDate Instant
  salary Long
  commissionPct Long
}
entity Job {
  jobTitle String
  minSalary Long
  maxSalary Long
}
entity JobHistory {
  startDate Instant
  endDate Instant
  language Language
}
enum Language {
  FRENCH,
  ENGLISH,
  SPANISH
}

relationship OneToOne {
  Country{region} to Region
  Location{country} to Country
  Department{location} to Location
  JobHistory{job} to Job
  JobHistory{department} to Department
  JobHistory{employee} to Employee
}
relationship OneToMany {
  /**
   * A relationship
   */
  Department{employee} to Employee
  Employee{job} to Job
}
relationship ManyToOne {
  Employee{manager} to Employee
}
relationship ManyToMany {
  Job{task(title)} to Task{job}
}

service Region, Country, Location, Department, Task, JobHistory with serviceImpl
search Region, Country, Location, Department, Task, Employee, Job, JobHistory with no
paginate Employee, JobHistory with infinite-scroll
paginate Job with pagination

Browsers and Operating System
  • Checking this box is mandatory (this is just to show you read everything)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants