Module perseus::i18n

source ·
Expand description

Utilities for internationalization, the process of making your app available in multiple languages.

Modules

  • Errors for translators. These are separate so new translators can easily be created in a modular fashion.

Macros

  • Gets the link to the given resource in internationalized form conveniently. The final argument to any call of this macro must be a Sycamore reactive scope provided to the relevant Perseus template.
  • Translates the given ID conveniently, taking arguments for interpolation as required. The final argument to any call of this macro must be a Sycamore reactive scope provided to the relevant Perseus template.

Structs

  • A dummy translator that will be used if an app doesn’t use internationalization. This has literally no capabilities whatsoever, and serves as a blank API interface. If this is called as if it’s a fully-fledged translator, it will panic.
  • The default translations manager. This will store static files in the specified location on disk, which should be suitable for the majority of use-cases, though users who want to store translations somewhere other than on the filesystem should use an alternative implementation. This mandates that translations be stored as files named as the locale they describe (e.g. ‘en-US.ftl’, ‘en-US.json’, etc.).
  • Defines app information about i18n, specifically about which locales are supported.
  • A dummy translator that will be used if an app doesn’t use internationalization. This has literally no capabilities whatsoever, and serves as a blank API interface. If this is called as if it’s a fully-fledged translator, it will panic.

Enums

Constants

Traits

  • A trait for systems that manage where to put translations. At simplest, we’ll just write them to static files, but they might also be stored in a CMS. It is strongly advised that any implementations use some form of caching, guided by FsTranslationsManager.