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.

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

    @QfListAttribute(sortable = true)
    @QfCreateAttribute(requiredOn = @QfRequiredOn(always = true))
    @QfDisplayLabel(text = "Product Name")
    private String name;

    @QfListAttribute(sortable = true)
    @QfDisplayLabel(text = "Price")
    private Integer price;
}

@QfI18nText

Declares additional text such as UI hints and placeholders.

java
@QfDisplayHint(
    i18n = @QfI18nText(locale = "en", message = "Enter in example@company.com format")
)
@QfCreateAttribute
@QfDisplayLabel(text = "Email")
private String email;

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.