Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create @modrinth/i18n package #2161

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Commits on Aug 15, 2024

  1. Switch to explicit Turborepo config

    This changes Turborepo config in the workspace root to be explicit.
    Explicity in this case means that all tasks are defined manually and all
    inputs are also specified manually.
    
    While that might seem redundant, this allows to orchestrate and adjust
    tasks more carefully - ignoring some files while taking other files into
    account, only hashing and providing project-specific variables,
    explicitly reviewing and specifying dependencies. That might come in
    handy in the future.
    
    There's an alternative way to approach this, which is to have every
    package contain "turbo.json" file, however, for now the flat approach
    has been chosen as it seems to be the most cleanest and easiest to
    review.
    brawaru committed Aug 15, 2024
    Configuration menu
    Copy the full SHA
    7d8ba50 View commit details
    Browse the repository at this point in the history
  2. Create @modrinth/i18n package

    @modrinth/i18n will be a package that contains the common messages that
    are used by two or more packages, as well as utilities for working with
    localisation, such as `defineMessage` macro and locale files resolver
    abstraction.
    
    It is pre-built in a manner that allows for harsh tree-shaking, meaning
    the messages that will not be used, should not be included by the
    bundlers.
    
    All messages are also defined using the `defineMessage` macro that
    cleans the descriptors and pre-parses `defaultMessage` to AST, which
    serves both as validation, as well as allows its use as fallback even in
    environments devoid of bundled-in compiler. When all other code parts
    are switched to use this macro, this might allow to exclude messages
    files for English language, potentially saving on removed duplication.
    
    Please note that currently `defineMessages` does not include
    `defaultMessage` because it is expected that consumers of
    `@modrinth/i18n` will include and pre-compile extracted messages file.
    This can be overriden by setting `MODRINTH_I18N_DEFAULT_MESSAGE`
    environment variable to `1`.
    brawaru committed Aug 15, 2024
    Configuration menu
    Copy the full SHA
    f494ab7 View commit details
    Browse the repository at this point in the history