i18n icon indicating copy to clipboard operation
i18n copied to clipboard

Allow splitting translations

Open intbvte opened this issue 1 year ago • 1 comments

Closes #51

As explained in the issue referenced above, sometimes it becomes too difficult to maintain translation files for a project and currently the library does not allow files to be split into different directories or files.

This pull-request implements this feature by walking every .ftl file in the locales directory, reading it, and merging it with any other translation it finds for that locale. This might not be the best way of implementing this feature... but it works. It also works with the standard translation layout currently implemented, which means users can use both types of layouts at once.

As of writing this, I haven't discovered anything that would be broken by this pull-request, please do let me know if it does in fact cause breaking changes or if any issues were discovered.

intbvte avatar Aug 29 '24 08:08 intbvte

I'll try to review this tonight

KnorpelSenf avatar Sep 11 '24 13:09 KnorpelSenf

@KnorpelSenf I've changed the makeTempLocalesDir utility function so that it creates a couple of split translations for other tests to use, if you had a different idea in mind for what tests to add, please let me know and I'll try to implement them.

intbvte avatar Sep 12 '24 11:09 intbvte

Thanks for merging the pull-request, are there any details on when the new version will be released?

intbvte avatar Sep 25 '24 05:09 intbvte

@rojvv said he wanted to do it “later” … I believe that means it'll happen today at some point. If that doesn't happen, feel free to ping me again

KnorpelSenf avatar Sep 25 '24 05:09 KnorpelSenf

Alright, no worries if it takes a couple of days.

intbvte avatar Sep 25 '24 05:09 intbvte

Available in 1.1.0.

rojvv avatar Sep 25 '24 14:09 rojvv

Apologies if I'm misunderstanding something, but was this version released correctly? I just tried to upgrade and I got a lot of errors. I looked at the source on NPM and saw that there is no src folder.

folder

intbvte avatar Sep 25 '24 15:09 intbvte

Apologies for the inconvenience. 1.1.2 should work.

rojvv avatar Sep 25 '24 15:09 rojvv

Works as expected, thanks!

intbvte avatar Sep 25 '24 15:09 intbvte