Skip to content

Internationalization (i18n) ​

Q-Framework declares multi-language strings via annotations. Localized display names can be defined directly in entity declarations, with no need to manage separate message files.

String Declaration ​

@QfI18n ​

The primary annotation for declaring localized display names. When placed on a field, it defines the display label for that field.

java
@QfEntity(
    appKey = "app",
    name = @QfI18n(defaultMessage = "Product", texts = {
        @QfI18nText(locale = "ko", message = "상품"),
        @QfI18nText(locale = "ja", message = "製品")
    })
)
public class ProductEntity {

    @QfI18n(defaultMessage = "Product Name", texts = {
        @QfI18nText(locale = "ko", message = "상품명")
    })
    @QfListAttribute(sortable = true)
    @QfCreateAttribute(requiredOn = @QfRequiredOn(always = true))
    private String name;

    @QfI18n(defaultMessage = "Price")
    @QfListAttribute(sortable = true)
    private Integer price;
}

@QfDisplayHint ​

Declares a tooltip or placeholder hint for a field.

java
@QfI18n(defaultMessage = "Email")
@QfDisplayHint(text = "Enter in example@company.com format")
@QfCreateAttribute
private String email;
AttributeDescription
keyMessage resource key for i18n resolution
textLiteral hint text (fallback)

Key Rules ​

Localization keys are automatically generated at compile time.

{appKey}.{entityName}.field.{fieldName}
    ↓
app.product.field.name
app.product.field.price

Entity display name key:

{appKey}.{entityName}.label
    ↓
app.product.label

These keys are automatically integrated with the frontend's i18n system.


Frontend Display Flow ​

Backend metadata API
    ↓
{
  "fields": [
    {
      "name": "name",
      "i18n": {
        "defaultMessage": "Product Name",
        "texts": [{ "locale": "ko", "message": "상품명" }]
      }
    }
  ]
}
    ↓
Frontend QfEntityView component
    ↓
Automatically selects display name based on current locale

Language Configuration ​

Set the language in the frontend.

typescript
// q-vue configuration
import { createQFramework } from '@softminds/q-vue'

const qf = createQFramework({
  locale: 'en',           // default locale
  fallbackLocale: 'en'    // fallback locale
})

When locale is en, the defaultMessage value is displayed. If a locale-specific text exists for the current locale, that value is used instead. If missing, it falls back to the defaultMessage.


Supported Languages ​

Currently supported languages:

CodeLanguage
enEnglish
koKorean
jaJapanese
zhChinese (Simplified)

INFO

Language codes follow the ISO 639-1 standard. Additional languages can be added through SPI extensions.


Next Steps ​

Released under the Apache 2.0 License.