solid-primitives icon indicating copy to clipboard operation
solid-primitives copied to clipboard

Make i18n translator resolver full generic

Open BierDav opened this issue 1 year ago • 9 comments

Make a few types more specific especially Scopes. Now we get proper types for available scopes and added support for nested scopes such as for example app.test

BierDav avatar Mar 24 '24 11:03 BierDav

🦋 Changeset detected

Latest commit: 5fa818c9baedb339829bc5ea374541769fdac0d1

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

This PR includes changesets to release 1 package
Name Type
@solid-primitives/i18n Minor

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 Mar 24 '24 11:03 changeset-bot[bot]

There are too many changes to the scope/chained/proxy functionality. Please just limit it to adding the generic for parameters when necessary.

I know, that's because of the now nicely working scope api. To get all the types right was really a challange and involved hours of hard work, so please can we also merge this 👉👈

BierDav avatar Mar 24 '24 21:03 BierDav

@BierDav can you fix this one as well? :)

thetarnav avatar Apr 04 '24 16:04 thetarnav

Of course

BierDav avatar Apr 04 '24 16:04 BierDav

Everything seems to be working as before. on solid-site too. I added a little test for the generic resolver types. Could you add tests for the improved functionality of scopes?

thetarnav avatar Apr 06 '24 16:04 thetarnav

Sorry oversaw the pr. I've added a test that should ensure that nested translation works, the other part with the types could also be checked by typechecking the test files, don't know if that is already done or not.

BierDav avatar Jun 13 '24 14:06 BierDav

Is there anything else needed for this feature? The templates are pretty limited as of now, compared to some other i18n libraries where you can e.g. pluralization in the templates, like: no apples | one apple | {count} apples (vue i18n)

marvin-j97 avatar Nov 08 '24 16:11 marvin-j97

This is not supported out of the box, but you can implement your own resolver which would allow you to support that syntax. This is even possible with the current implementation, no need for this pr.

BierDav avatar Nov 08 '24 18:11 BierDav

@thetarnav is this ready to merge?

BierDav avatar Nov 18 '24 20:11 BierDav