Constructive i18n
Multilingual support at every layer — from database schema to GraphQL API. Three pieces compose together:
DataI18n— blueprint node creating{table}_translationswith per-locale copies of translatable fieldsSearchFullTextwithlang_column— tsvector search where each row is stemmed in its own language (30+ languages via PostgreSQL built-in configs)i18n_module— app-level config for default language, supported languages, and fallback chaingraphile-i18n— PostGraphile v5 plugin addinglocaleStringswith Accept-Language negotiation
When to Apply
Use this skill when:
- Making fields translatable with DataI18n
- Adding multilingual full-text search
- Configuring app-level language settings
- Working with Accept-Language content negotiation
- Setting up per-row language stemming for tsvector
DataI18n Blueprint Node
{
"tables": [{
"table_name": "articles",
"nodes": [
"DataId", "DataTimestamps",
{ "$type": "DataI18n", "data": {
"fields": ["title", "description"],
"languages": ["en", "es", "fr", "de"]
}}
],
"fields": [
{ "name": "title", "type": { "name": "text" }, "is_required": true },
{ "name": "description", "type": { "name": "text" } }
]
}]
}
Creates articles_translations table with language, title, description columns per locale.
Multilingual Search
Compose DataI18n with SearchFullText using lang_column for per-row stemming:
{ "$type": "SearchFullText", "data": {
"field_name": "search_tsv",
"lang_column": "language",
"source_fields": [
{ "field": "title", "weight": "A" },
{ "field": "description", "weight": "B" }
]
}}
30+ languages supported out of the box via PostgreSQL text search configurations (english, spanish, french, german, japanese, etc.).
i18n Module
Provisions app_settings_i18n singleton with:
default_language— fallback languagesupported_languages— array of enabled localesfallback_chain— ordered fallback for missing translations
graphile-i18n Plugin
Adds localeStrings computed field to GraphQL types with Accept-Language header negotiation. Returns translations in the requested locale with automatic fallback.
Cross-References
- Search strategies:
constructive-search - Blueprint definitions:
constructive-blueprints - ORM query patterns:
constructive-orm