Localization

Multi-language support for content and interfaces using IETF language tags.

Bosca includes built-in localization support through its Languages module, making it straightforward to manage the languages your platform supports and associate content with specific locales.

How Languages Work

Languages in Bosca are identified by IETF BCP 47 language tags (e.g., en, es, es-419, pt-BR). Each language record includes:

  • tag — the IETF language tag (primary key)
  • name — the English display name (e.g., "Spanish")
  • localName — the language's name in its own script (e.g., "Español")
  • attributes — optional JSON metadata for custom properties
type Language {
    tag: String!
    name: String!
    localName: String!
    attributes: JSON
}

Pre-Installed Languages

When Bosca is first set up, the language installer seeds a default set of languages covering major world languages:

TagNameLocal Name
enEnglishEnglish
esSpanishEspañol
es-419Spanish (Latin America)Español (Latinoamérica)
pt-BRPortuguese (Brazil)Português (Brasil)
frFrenchFrançais
hiHindiहिन्दी
plPolishPolski
tlTagalogTagalog
ruRussianРусский
nlDutchNederlands
koKorean한국어
teTeluguతెలుగు
swSwahiliKiswahili

These are installed idempotently—re-running the installer will not duplicate existing entries.

Querying Languages

Retrieve all available languages via GraphQL:

query {
  languages {
    all {
      tag
      name
      localName
      attributes
    }
  }
}

Managing Languages

Languages can be added, edited, and removed through the LanguagesService API:

  • Add a new language by providing a tag, name, and local name
  • Edit an existing language to update its display names or attributes
  • Delete a language by its tag

This allows organizations to customize the language list to match their audience—add regional variants, remove unsupported languages, or attach custom attributes for UI configuration.

Language Tags in Practice

Bosca uses standard Java Locale facilities to resolve display names from IETF tags. This means:

  • Regional variants like es-419 (Latin American Spanish) and pt-BR (Brazilian Portuguese) are first-class citizens
  • The localName is automatically derived from the locale's own display name, ensuring correct capitalization and script
  • Custom or rare language tags can be added manually with any display names you choose

How It Fits Together

  • Content: Languages enable multi-language content strategies. Collections and metadata can be associated with specific languages for localized delivery.
  • Profiles: User language preferences can be stored in Profile attributes to personalize the experience.
  • Search: Language-aware content can improve relevance in Search results.
  • Organizations: Different Organizations can support different language sets based on their audience.

For Developers

The localization system is split across two modules:

  • backend/framework/core-languages — model (Language) and service interface (LanguagesService)
  • backend/framework/languages — implementation, GraphQL controller (LanguagesController), and the LanguagePackageInstaller

The GraphQL schema is defined in backend/framework/languages/src/main/resources/graphql/languages.graphqls.

To add a new language programmatically:

languagesService.add(
    Language(
        tag = "ja",
        name = "Japanese",
        localName = "日本語"
    )
)