Instruction file imported from omergulcicek/omergulcicek.com (
.cursor/rules/i18n.mdc). Copyright stays with the author.
Internationalization (i18n)
Constraints
- Library Selection: Delegate specific hook/method usage to the framework constitution (
nextjs.mdcortanstack-start.mdc). - Keys: Use flat or max 3-level deep JSON structures. Use
camelCasefor keys. - SSOT: All translation keys MUST be defined in
src/messages/. - Type Safety: Use the library's native type-generation features. Magic strings for keys are forbidden.
- Namespacing: Use namespaces for features (e.g.,
auth.login,profile.settings) to maintain modularity.
Bans
- Hardcoded strings in UI components.
- Dynamic key construction (e.g.,
t("prefix." + variable)). - Reading locale via
window.locationor manual URL parsing. - JSON hierarchy deeper than 3 levels.
- Async translation loading that causes layout shifts.
Correct Implementation
Incorrect Implementation
// BAN: Dynamic key generation const label = t("welcome_" + type);