I worked on the frontend of Hitachi BuilMirai at GlobalLogic. The frontend was a modular monolith in a Turborepo monorepo, with four modules: admin, customer, global and ui.
Problem
The product had to ship in English and Japanese, and nothing for internationalisation existed yet. Every string in the four modules, about 400 keys per module, had to move out of the code and into translation files.
Official Japanese translations came from Hitachi’s Japanese product team, and they arrived late, close to UAT. The UAT testers were native Japanese speakers, so anything that read or looked wrong in Japanese would be caught there, in the last stage before release.
Constraints
- Translation changes had to ship without waiting for a frontend release.
- Official Japanese text would not exist until late in the project.
- Many pages had been built with fixed widths and rigid layouts, sized for English.
- German and other European languages were being discussed, so a third language had to stay cheap to add.
Decisions
Translations in their own repository
I designed the early layout of the localisation setup with the senior architect, with the team leads involved. Translations went into a separate repository instead of the frontend. A copy change is a pull request in that repository. Once it’s merged, a CI job, built mostly by the DevOps team, publishes the files to a CDN. The frontend and the translations release on their own schedules.
The trade-off: the app and the translations can drift apart, because a key can exist in one before the other.
Split by locale, then by module
Each locale has a directory (en, ja), and each directory has one file per frontend module. The files mirror how the code is organised, so a change to the admin module means editing the admin file. I wrote the frontend side: how the app loads these files and uses them through react-i18next.
At login the app downloaded all the translation files at once, with no caching between sessions and no fallback language. That kept the first version simple. The cost is that every login pays for every module’s strings, whether or not the user opens those screens.
Test with machine-translated Japanese until the real text arrives
We didn’t wait for the official translations before testing layouts. We machine-translated the English strings into Japanese ourselves and ran the app with those until the Japanese product team sent verified text. That surfaced many layout problems while there was still time to fix them.
Japanese typography
Both a subset Japanese web font (Noto Sans JP) and system fonts were demoed. We kept system fonts because they performed better. Pages set lang="ja", so browsers pick Japanese glyph shapes instead of Chinese ones for shared characters. Line breaking uses line-break: strict, which stops lines from starting with characters Japanese typography forbids there, and word-break: auto-phrase, which breaks between phrases instead of anywhere. A few places use break-all. Where Japanese text looked cramped, the line height went up.
Generic illustration, not production code:
:lang(ja) {
line-break: strict;
word-break: auto-phrase;
}
:lang(ja) .prose {
line-height: 1.8;
}
Flexible layouts, with tooltips where structure has to hold
Japanese ran longer than English in many places. Button labels, modal text and table column headers overflowed, and some grid layouts pushed important content down the page or added horizontal scrolling. Where a layout could flex, I made it flex. Where a feature’s structure had to stay fixed, text truncates and the full string shows in a tooltip. The point was one consistent rule across pages, not a different patch on each one.
Result
- Japanese shipped to users. UAT was done by native Japanese speakers, and the release passed their sign-off.
- The UAT fixes took two weeks, and I made most of them.
- German and other European languages were under discussion when I left. In this layout, a new language is a new directory with the same files. That was never put to the test while I was there.
What I’d change now
- Load strings per feature: one file per feature instead of per module, each loaded when its page first opens, with English as the fallback. Files would be cached with a content hash in the URL.
- Use a translation management tool (Crowdin, Lokalise or Phrase) that syncs into the repository, so translators work with context and screenshots instead of JSON.
- Add pseudo-localisation to CI, alongside machine translation. Pseudo-localised text is deliberately longer and wrapped in markers, so it catches overflow and hard-coded strings for any language, German included, before a translator is involved.
- Format dates, numbers and units with the browser’s
IntlAPIs, and plurals with ICU message format. Japanese doesn’t inflect plurals; German does. - Generate key types from the English files, so a missing key fails the build instead of showing up in UAT.
Generic illustration, not production code:
import i18n from "i18next";
import HttpBackend from "i18next-http-backend";
import { initReactI18next, useTranslation } from "react-i18next";
i18n
.use(HttpBackend)
.use(initReactI18next)
.init({
fallbackLng: "en",
ns: ["common"], // loaded at start
defaultNS: "common",
backend: {
// one file per locale and feature, e.g. ja/orders.json
loadPath: "/locales/{{lng}}/{{ns}}.json",
},
});
// A page loads its own strings the first time it renders
const { t } = useTranslation("orders");