mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
- 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.
18 lines
426 B
Plaintext
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;
|
|
}
|
|
|