Translatable strings β¨
Provides DSL for autotranslatable strings
With this module you can easily write multilanguage programs!
Minimal Example π¨βπ¬
translable: "Hello, world!": # "Hello, world!" by default "ru" -> "ΠΡΠΈΠ²Π΅Ρ, ΠΌΠΈΡ!" "fr" -> "Bonjour, monde!" serve("127.0.0.1", 5000): get "/": return translate("Hello, world!")
Types
LanguageSettings = object lang*: string
Macros
macro translatable(body: untyped): untyped
-
Make translations for strings
Use standalone file with your translations for good practice.
Example
translatable: # If lang is unknown than used "My own string" "My own string": "ru" -> "ΠΠΎΡ ΡΠΎΠ±ΡΡΠ²Π΅Π½Π½Π°Ρ ΡΡΡΠΎΠΊΠ°" "fr" -> "..."
macro translate(self: string): string
- Translates self string to current client language (SPA) or accept-language header (SSG/SSR)