Appearance
aivi.i18n
Internationalisation marker helpers for user-facing text.
This module is deliberately small today:
trreturns the text you pass in unchangedtrnchooses the singular text when the count is1, otherwise the plural text
That still lets you mark strings for translation now, even before a real locale/catalog runtime is wired in.
Import
aivi
use aivi.i18n (
tr
trn
translate
translatePlural
)Overview
| Function | Type | Description |
|---|---|---|
tr | Text -> Text | Mark one string for translation |
trn | Text -> Text -> Int -> Text | Choose singular or plural text |
translate | Text -> Text | Longer alias for tr |
translatePlural | Text -> Text -> Int -> Text | Longer alias for trn |
tr
aivi
tr : Text -> TextMark a single string for translation.
aivi
use aivi.i18n (tr)
value saveLabel : Text =
tr "Save"trn
aivi
trn : Text -> Text -> Int -> TextChoose between a singular and plural form.
aivi
use aivi.i18n (trn)
type Int -> Text
func fileCountLabel = count =>
trn "1 file" "{count} files" counttranslate
aivi
translate : Text -> TextFriendly alias for tr.
translatePlural
aivi
translatePlural : Text -> Text -> Int -> TextFriendly alias for trn.
Example
aivi
use aivi.i18n (
tr
trn
)
value title : Text = tr "Downloads"
type Int -> Text
func itemLabel = count =>
trn "1 item" "{count} items" count