Rune-Web
Localization in Rune-Web
Keep translated copy in named @I18N bundles, then reference the same keys in every view. This site uses English, Spanish, and French bundles written in Rune.
#!RUNE
@App
name = Multilingual site
type = REST
@Frontend
type = rune-web
path = %ROOT%
page = home
locale = en_us
locale_paths = { "es": "/es/", "fr": "/fr/" }
@I18N/en_us
Common {
hello = "Hello"
}
@I18N/es
Common {
hello = "Hola"
}
@I18N/fr
Common {
hello = "Bonjour"
}
@Page/home
view:
main:
h1 "%i18n.Common.hello%"
a href=/ "English"
a href=/es/ "Español"
a href=/fr/ "Français"
Define and use translation keys
An @I18N/locale section contains named groups such as Common. Use i18n.Common.hello in text or attributes. You can also use the expression i18n.Common.hello. Keep matching groups and keys in every bundle; missing keys have no automatic English fallback.
Choose a locale
locale = en_us on @Frontend sets the default bundle. On the native server, ?locale=es selects another defined bundle for that request. Locale names must match your @I18N section names exactly.
Use the same links locally and in production
locale_paths maps bundles to explicit server paths. In this example, /es/ and /fr/ work when running the Rune app locally. For static hosting, export each locale path to its own index.html and copy the site assets; a static host does not process ?locale= parameters.
vectrune localization.rune
vectrune localization.rune --path /es/ -o html > spanish.htmlHelp finish a translation
The teaching site’s translation files live in teaching_website/parts/i18n. Update the matching keys in en_us.rune, es.rune, and fr.rune. Keep Rune keywords, builtin names, file paths, and example source code unchanged.
Help translate on GitHub ↗