Development

Translation Key

A unique identifier used to reference a translatable string in code.

Definition

A translation key (also called message ID or string key) is a unique identifier that maps to translated content. Instead of hardcoding text, developers use keys like 'home.welcome.title' that the i18n library resolves to the appropriate translation. Good key naming conventions make code maintainable and help translators understand context.

Examples

  • Hierarchical: 'auth.login.button.submit'
  • Feature-based: 'checkout.payment.error.card_declined'
  • Component-scoped: 'UserProfile.bio.placeholder'

Frequently Asked Questions

What is a good translation key naming convention?

Popular patterns: 1) feature.component.element: 'checkout.cart.total_label' 2) page.section.item: 'home.hero.cta_button' 3) Dot-notation hierarchy with 2-4 levels. Avoid: using the English text as key, overly long keys, inconsistent formatting.

Should I use the source text as the key?

Not recommended. Using 'Welcome to our app' as a key means changing the English text requires updating all language files. Semantic keys like 'home.welcome.title' are independent of any specific translation.

Related Terms

Ready to simplify your i18n workflow?

Start managing translations with IntlPull.

    Translation Key - Definition & Examples | IntlPull Glossary | IntlPull