Files
c3c/lib/std/text/i18n.c3
Christoffer Lerno 5c77c9a754 - Change distinct -> typedef.
- Order of attribute declaration is changed for `alias`.
- Added `LANGUAGE_DEV_VERSION` env constant.
- Rename `anyfault` -> `fault`.
- Changed `fault` -> `faultdef`.
- Added `attrdef` instead of `alias` for attribute aliases.
2025-03-15 20:10:47 +01:00

18 lines
426 B
Plaintext

/*module std::text::i18n;
import std::collections::map;
import std::hash::fnv32a;
typedef Language = char[];
const Language EN = "en";
alias TranslationMap = HashMap{String, String};
fn uint Language.hash(self) => fnv32a::encode((char[])self);
HashMap{Language, TranslationMap*} language_map @private;
TranslationMap? current_map;
macro String @localized(String string) @builtin
{
return current_map[string] ?? string;
}