This document provides a comprehensive ruleset for naming internationalization (i18n) keys and keysets in this project. Following these conventions ensures consistency, maintainability, and clarity in multilingual applications.
Keysets are divided into 4 categories:
- System-wide - Used across many sections (e.g.,
common,common.units,common.operations) - Section-wide - Common within a section (e.g.,
billing.common) - Page-specific - Specific to section pages (e.g.,
billing.account) - Reusable components - For shared components (e.g.,
logs.events)
- MUST: Write context description for each keyset
- MUST: Keep keysets concise (prefer
billing.budgetsoverbilling.account.budgets) - MUST NOT: Create keysets with only a few keys - merge with existing section keysets
- MUST NOT: Create multiple keysets for sections/popups within the same area
- MUST NOT: Start reusable component keysets with
component.- use the section name instead
Keys follow the pattern: <element-context>_<content-text>
Use these standard context prefixes:
| Prefix | Usage | Example |
|---|---|---|
context |
Contextual information, hints, section descriptions | context_save-up-and-service-sales |
alert |
System feedback, notifications, warnings | alert_load-document-error |
action |
User actions: buttons, links, menu items | action_document-view |
field |
Resource field names in tables, forms, overviews | field_account-name |
title |
Titles of sections, pages, popups, menu items | title_billing-section |
confirm |
Confirmation prompts and calls to action | confirm_delete-resource |
value |
Radio button values, statuses, field values | value_active-status |
- MUST: Make content description unambiguous and concise
- MUST: Use hyphens to separate words in content description
- MUST NOT: Use
label_prefix (deprecated) - SHOULD: If context cannot be determined, omit the prefix
| Text | Key |
|---|---|
| Error loading document (notification title) | alert_load-document-error |
| Report document not ready, try later (notification message) | alert_act-not-ready-error |
| Scheduled maintenance on 12.02.2022 14:00-15:00 | alert_planned-maintenance |
| View document (button) | action_document-view |
| Prefix | Purpose | Processing |
|---|---|---|
raw_ |
Bypass typography processing | Text displayed as-is |
md_ |
Enable markdown formatting | Supports bold, italic, [links] |
- MUST NOT: Use HTML markup in text
- MUST: Use YFM markdown syntax for formatting
- CAN: Add link attributes using markdown syntax:
{ "md_example-key": "Learn [more](https://example.com){target=_blank rel=\"noreferrer noopener\"}" }
Keys must only contain characters matching this pattern:
^[a-z0-9\u0400-\u04ff[\](){}<>!@#$%^&*~_\-−–—+='"`«»„"''"?.,:;|\\/ ₽™®©№\u00a0]*$/iThis includes:
- Latin letters (a-z, A-Z)
- Numbers (0-9)
- Cyrillic letters (\u0400-\u04ff)
- Common punctuation and symbols
- Non-breaking space (\u00a0)
- Currency symbols (₽)
- Special characters (™®©№)
- ✅ Keep keys descriptive but concise
- ✅ Group related keys in appropriate keysets
- ✅ Use consistent naming patterns within a project
- ✅ Document keyset context and purpose
- ✅ Review existing keys before creating new ones
- ❌ Don't create overly granular keysets
- ❌ Don't duplicate keys across keysets
- ❌ Don't use technical jargon in user-facing keys
- ❌ Don't include implementation details in key names
- ❌ Don't use special characters outside the allowed set
For region-specific content, use appropriate postfixes as defined in the regional keys documentation.
Before finalizing i18n keys, verify:
- Key follows
<context>_<content>format - Context prefix is from the standard list
- Content description is clear and concise
- Key is placed in appropriate keyset
- No forbidden characters are used
- Formatting prefixes (
raw_,md_) are used correctly - No HTML markup in text values
{
"common": {
"action_save": "Save",
"action_cancel": "Cancel",
"field_name": "Name",
"field_description": "Description"
},
"billing.account": {
"title_billing-overview": "Billing Overview",
"alert_payment-failed": "Payment processing failed",
"context_billing-help": "Manage your billing accounts and payment methods",
"confirm_delete-account": "Are you sure you want to delete this account?"
},
"logs.events": {
"field_timestamp": "Timestamp",
"value_error-level": "Error",
"action_filter-logs": "Filter logs"
}
}