Skip to content

API Reference

Everything ordinary use needs is on the package root:

python
from vue_i18n import create_core_context, translate, datetime, number
create_core_contextbuild the context everything else is called against
translatetranslate a key — vue-i18n's t()
datetime, numberformat a date or a number — d() and n()
vue_i18n.pluralsthe opt-in CLDR plural rules

Everything exported

python
from vue_i18n import (
    create_core_context,        # build a context
    CoreContext,                # its type
    translate,                  # t()
    datetime,                   # d()
    number,                     # n()
    update_fallback_locale,     # change fallback_locale safely
    fallback_with_locale_chain, # the default fallback walker
    fallback_with_simple,       # the other one
    NOT_RESOLVED,               # what unresolving=True returns
    I18nWarning,                # the warning category
    create_parser,              # parse a message without rendering it
    CompileError,               # what a malformed message raises
)

Naming

Names are vue-i18n's, in snake_case, and the concepts are unchanged:

vue-i18nhere
createI18n / createCoreContextcreate_core_context
t / translatetranslate
ddatetime
nnumber
fallbackLocalefallback_locale
missingWarn, fallbackWarnmissing_warn, fallback_warn
pluralRulesplural_rules
postTranslationpost_translation
escapeParameterescape_parameter

d and n are spelled out because a single letter is not a name in Python. Import them under the short name if you prefer the symmetry with the front end:

python
from vue_i18n import datetime as d, number as n

Released under the MIT License. vue-i18n is © kazuya kawaguchi and contributors; this is an unofficial port and is not affiliated with intlify.