monorepo icon indicating copy to clipboard operation
monorepo copied to clipboard

MESDK-77 Requirements for Gender and Plurals [WORKING DRAFT]

Open LorisSigrist opened this issue 1 year ago • 7 comments

This PR updates the internal Message AST to include all the functionality we need to implement plurals, genders and other formatting functions.

It also adds the experimental and not for public use icu2-message-format plugin which is able to load (not save) messages from icu2 files.

CI will probably freak out because the Message-Type was heavily edited, but that's alright for the moment

HOW TO TEST

  • Build versioned-interfaces/message
  • Build plugin/icu2-message-format
  • Build SDK
  • Run test in development-projects/icu2

This should log the loaded messages. However, for some reason the SDK doesn't return any values or errors. The plugin does work (can also be seen in the logs).

LorisSigrist avatar Apr 25 '24 14:04 LorisSigrist

🦋 Changeset detected

Latest commit: d1879fda6d736a778410d68ee88b98649386c7f7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 40 packages
Name Type
@inlang/message Major
@inlang/rpc Patch
@inlang/sdk Patch
@inlang/message-lint-rule-camel-case-id Patch
@inlang/message-lint-rule-empty-pattern Patch
@inlang/message-lint-rule-identical-pattern Patch
@inlang/message-lint-rule-without-source Patch
@inlang/message-lint-rule-missing-translation Patch
@inlang/message-lint-rule-snake-case-id Patch
@inlang/message-lint-rule-valid-js-identifier Patch
@inlang/importer Patch
@inlang/message-lint-rule Patch
@inlang/plugin Patch
@inlang/cli Patch
vs-code-extension Patch
@inlang/server Patch
@inlang/icu2-message-format-test Patch
@inlang/badge Patch
@inlang/doc-layout-component Patch
@inlang/github-lint-action Patch
@inlang/settings-component Patch
@inlang/telemetry Patch
@inlang/cross-sell-ninja Patch
@inlang/plugin-i18next Patch
@inlang/plugin-json Patch
@inlang/plugin-m-function-matcher Patch
@inlang/plugin-next-intl Patch
@inlang/plugin-t-function-matcher Patch
@inlang/paraglide-unplugin Patch
@inlang/paraglide-js-e2e Patch
@inlang/sdk-load-test Patch
@inlang/module Patch
next-js-testapp Patch
@inlang/sdk-multi-project-test Patch
@inlang/paraglide-rollup Patch
@inlang/paraglide-vite Patch
@inlang/paraglide-webpack Patch
@inlang/paraglide-astro Patch
@inlang/paraglide-sveltekit Patch
@inlang/paraglide-sveltekit-example Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Apr 25 '24 14:04 changeset-bot[bot]

@LorisSigrist Could you add a note in the OP with how to build and run this - I was hoping to look at the structure in a debugger. (the monorepo build freaked out when I tried it 😺)

jldec avatar Apr 25 '24 18:04 jldec

🥷 Ninja i18n – 🛎️ Translations need to be updated

❗️ New errors in setup of project /icu2/project.inlang found

ModuleImportError Couldn't import the plugin "./../../source-code/importers/icu2-message-format/dist/index.js":

Error: ENOENT: no such file or directory, open '/home/runner/work/monorepo/monorepo/merge/inlang/source-code/importers/icu2-message-format/dist/index.js'

Error cause ENOENT: no such file or directory, open '/home/runner/work/monorepo/monorepo/merge/inlang/source-code/importers/icu2-message-format/dist/index.js'

Stack trace Error: ENOENT: no such file or directory, open '/home/runner/work/monorepo/monorepo/merge/inlang/source-code/importers/icu2-message-format/dist/index.js'

PluginsDoNotProvideLoadOrSaveMessagesError No plugin provides a `loadMessages()` or `saveMessages()` function

In case no plugin threw an error, you likely forgot to add a plugin that handles the loading and saving of messages. Refer to the marketplace for available plugins https://inlang.com/marketplace.

github-actions[bot] avatar Apr 26 '24 09:04 github-actions[bot]

@LorisSigrist Could you add a note in the OP with how to build and run this - I was hoping to look at the structure in a debugger. (the monorepo build freaked out when I tried it 😺)

@jldec i hope we can reduce the friction we create with this pr a lot by introducing a separate type internally and map the in/out type we use in load/saveMessage to the newly created type (related related), we can discuss a possible strategy in person tomorrow.

martin-lysk avatar Apr 28 '24 23:04 martin-lysk

@martin-lysk The new interface package and importer plugin package both feel a bit premature for the scope of this PR - Are they really necessary? What capabilities are they expected to unlock for our app developers

Why not ship a small sdk-integrated importer similar to the experimental persistence feature, just for testing.

(The same is perhaps true also for the development-project in this PR - I think I'd prefer to maintain test projects for the sdk under the sdk tree)

jldec avatar Apr 30 '24 16:04 jldec

@jldec yes - agree: we will keep the final PR small. Adding the importer intended to outline in code how we the approach enables us to add new functionality to the existing SDK while keeping the old structure functional. To get to a POC of the discussed "reactive thin layer" the importer can stay as it is. I suggest we open up a new PR when we got an agreement with the team and types got merged.

martin-lysk avatar May 02 '24 08:05 martin-lysk

Thanks @martin-lysk

I asked @LorisSigrist about the motivation for the importer and he confirmed that

We needed a way to load messages with the new AST. Since we decided to leave the Plugin API as-is for compatibility we figured we would add a load-only eqivalent for the new AST. Unless the ICU2 Importer package is moved into the SDK itself there needs to be an Interface defined somewhere

So my preference would be to follow the pattern already shipping with the experimental persistence flag, and move that importer code inside the sdk for now. That would eliminate the complexity associated with building and loading a separate plugin while we are iterating on the persistence architecture.

jldec avatar May 03 '24 07:05 jldec

closing with branch intact.

jldec avatar May 10 '24 20:05 jldec