tolgee / tolgee-platform

Developer & translator friendly web-based localization platform
https://tolgee.io
Other
2.08k stars 205 forks source link

Export strings for Compose Multiplatform #2397

Open mauriziofaleo opened 4 months ago

mauriziofaleo commented 4 months ago

Feature request Strings for Compose Multiplatform need to be stored in an XML file encoded in a similar way to those used by Android, with some minor differences. For this reason, strings exported by Tolgee with the Android exporter are not immediately usable for mobile apps based on Compose Multiplatform and need some manual changes.

The only two differences I've identified are:

Describe the solution you'd like I'd like to have a new export option called "Compose Multiplatform" which reuses the same implementation of the Android exporter, with the two differences I've mentioned before:

Describe alternatives you've considered The workaround I'm currently using is:

Additional context If you want to know more about Compose Multiplatform resources, you can check the official doc.

Thank you!

JanCizmar commented 4 months ago

Hey! Thanks! Will look into that!

mauriziofaleo commented 4 months ago

Thank you Jan for considering it! I'm available for any kind of questions you might have!

Nailik commented 4 months ago

Another thing is the starting tag: <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">

should only be <resources>

for multiplatform

btw i would like this for android as well:

Positional arguments are exported for Android as %s without any indication of the argument number. For Compose Multiplatform, it should be %1$s, %2$s, etc. (source)

JanCizmar commented 4 months ago

Hey! We will do following:

mauriziofaleo commented 4 months ago

Remove the quoting logic for multiplatform files. Do I understand it correctly that there is no quoting logic for compose multiplatform resources?

Exactly, on Compose Multiplatform we don't need to escape ' and ", so the logic needs to be removed.

Nailik commented 3 months ago

Another note, for multiplatform html tags should not be encoded as well. You could test it with AnnotatedString.fromHtml(htmlString), there's also no need to wrap with cdata which removes the need of this android flag for multiplatform (or compose in general when using this approach)

Anty0 commented 1 month ago

Another note, for multiplatform html tags should not be encoded as well. You could test it with AnnotatedString.fromHtml(htmlString) ...

@Nailik Hi! Do you have some example files with this edge case? I'm trying to understand the difference. Thanks!