-
Notifications
You must be signed in to change notification settings - Fork 0
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
Requirements for a messages function registry with types #58
Comments
@loris.sigrist, @martin.lysk1 |
The main question for the registry is who owns it. Is it part of the Ecosystem itself via the SDK or is it App-specific, or a mix. If it's owned by the Ecosystem, how is it exposed to the Apps. Do we have an actual Data-Model + API or is it simply a standard that's implemented in each App with no in-memory representation. Simply having a standard seems better IMO. We already talked about and decided that the best way to represent types in an app agnostic way is with regexes. The registry should represent types with them. Eg: Date = Apps that need to give Type-Information can have their own mapping from regex -> App-specific type system. |
The project owns the registry. As an app, you have to comply. E.g. the project defines a For the registry, I propose a property Okay, wuuuuuups here might be the answer for paraglide and on how to ensure consitency across different i18n libraries. The project owns the implementation with source code stored in the project itself (see
|
In this case, who would provide the mapping from |
For defaults functions like plural, yes i propose we provide a default implementation. But, I revert my course: I don't think leaking source code into an inlang project file is a good idea. i18n libs should be responsible for providing the function because this is a dev only problem. there is no need to make life difficult by storing source code in an inlang project. Summary
Paraglide/developers in an inlang project. If the registry contains a type, it's up to developers to provide the correct type for. How you compile this in paraglide will be your job then. You can provide a settings field for paraglide that devs can define. For default functions like |
Sounds good! I'll try implementing that to see if it holds up, but it seems like it will work |
Findings after implementing this:
|
Most likely a wrong assumption but doesn't matter anyways because the moment a function registry exists, we can enable adding custom functions.
Does it matter what devs want? Translators need predictable input -> output when creating a translation. Cool that |
I think we're at risk of confusing concrete Implementation and Interface here. But, we can't share an implementation of the We will need platform-specific implementations of the function anyways. As long as the interface & semantics are the same that doesn't matter.
They have that as long as they use the registry. There is no downside to the platform specific implementation using platform specific types as long as they have the same semantics. |
Oh yes. Can you confirm with the info below that we talk about the same thing?
|
That works! The registry defines the functions that are available + the interface. It uses regex strings to define the shared types. The JS "mock implementations" take strings values that obey the regexes & render correctly. They can be used by Editors / Apps to show previews without needing to use any Platform Types. Platform i18n libraries (like Paraglide) provide their own platform specific implementations that is equivalent to the mock implementation but may use Platform types instead of just strings. |
Context
Messages can be defined with variable replacements or match selectors which contain functions.
E.g. message with a
plurals
function (from MESDK-77 here):(this example uses MF2, but inlang v2 Message type semantics are the same)
@loris.sigrist has implementated a registry here as an example to be used by paraglide-js
Requirements for the function registry
Proposal
[add api proposal here]
The text was updated successfully, but these errors were encountered: