This repository has been archived by the owner on Aug 28, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds support for translations using VIntl module as a peer dependency.
Peer dependencies are dependencies that have to be provided by the
consumer, which means that
@vintl/vintl
has to be installed and set upin Theseus and any other consumers.
Translations for Omorphia are done in Omorphia to prevent duplicate
work, and the consumer has to import the locale files like they do for
with the styles already. Those locale files have to be registered in
VIntl plugin and processed using
@vintl/unplugin
.@vintl/unplugin
is a Unplugin (which means it works with Rollup, Vite,and even Webpack) that takes in locale files generated by
@formatjs/cli
utility and transforms them into the proper ES modules.This allows consumers to get rid of the
intl-messageformat-parser
,which has a huge toll on the bundle size otherwise, at the cost of
inability to parse custom messages.
To give an example of how this can be approached, docs have been updated
to support changing the language used in examples. Knossos is already
doing all this automatically by using
@vintl/nuxt
.@formatjs/cli
allows to define messages directly and the code and thenautomatically extract them into the locale file. Collocation makes it
easier to maintain the messages and see them right in the code.
Translations are done using Crowdin, so Crowdin needs to be connected to
this repository, just like it was connected to Knossos 1. This commit
also introduces a config that allows to do just that.
Footnotes
https://github.com/modrinth/knossos/pull/738#merge-and-integration ↩