nextcloud / neon

A framework for building convergent cross-platform Nextcloud clients using Flutter.
Other
124 stars 31 forks source link

Translation of i10n strings #401

Open ceskyDJ opened 1 year ago

ceskyDJ commented 1 year ago

Hi there! I'd like to translate your i10n strings into Czech. There is no guide for the translation process (at least I couldn't find it), so I tried to find the way myself. I found file en.arb with English strings. So, can I just add cs.arb and create a pull request with it?

provokateurin commented 1 year ago

Yep, that should work, but you need to run fvm flutter gen-l10n. Also note that there are multiple localization files that would need to be translated. Thanks for your efforts!

provokateurin commented 1 year ago

Or @Leptopoda do you think we should wait with translations until we have a proper translation service (probably transifex because that is also used by Nextcloud itself)?

ceskyDJ commented 1 year ago

I think using Transifex would be the best option. I can contribute here or there, it doesn't matter but there are many translators on Nextcloud‘s Transifex, so your project could be translated into more languages than when you just use slang or manual translations. It's your choice, of course, so let me know after you make a decision, please.

provokateurin commented 1 year ago

On the technical side there are some problems with transifex because they don't support exporting to arb which flutter uses. We will probably write a script to convert some of their output formats to arb.

Leptopoda commented 1 year ago

I don't think there's anything against accepting direct PRs (as long as it's not escalating with multiple people trying to translate the same language). I'm all for the added accessibility!

On the other hand @provokateurin you are probably skilled enough with jq to write a converter so we could also just make that happen. As long as we don't need gender support we should be good to go (IIRC transifex supports json with ICU plurals).

provokateurin commented 1 year ago

I wonder how hard it is to setup Transifex for this project and then later migrate to the Nextcloud transifex.

I could also just ask to get added to the Nextcloud Transifex without the repo being in the Nextcloud org. Not sure if that will work though.

@ceskyDJ You can totally open PRs to add translations, the process will not be very coordinated though.

ceskyDJ commented 1 year ago

Ok, thanks. I‘ll look at it in the future. It will be better, if you add some Github Actions that process arb files automatically, so I wouldn't need to setup Flutter.

provokateurin commented 1 year ago

Hm yes we can do that in the future. You can also just add your translations and someone else can regenerate the code for you.

provokateurin commented 1 year ago

Alright I was pointed to these docs: https://docs.nextcloud.com/server/latest/developer_manual/basics/front-end/l10n.html#adding-translations So it is possible to add Transifex to this repo.

As far as I can tell we need to generate a POT file from the en.arb files (while merging the keys using prefixes) and then Transifex will drop us some PO files that we need to generate to arb files again (while splitting the keys using prefixes). @Leptopoda does that make sense? I assume it is quite some work to get it all working and automated, but once we have it we can utilize the whole Nextcloud translation community which would be really cool.

provokateurin commented 1 year ago

The PO-ARB and ARB-PO conversion looks quite complex, so we will probably need to create a new dart cli package for that (which could be re-used by other apps of course).

Leptopoda commented 1 year ago

I think the mentioned PO stuff is only needed if we want to use the nc-transifex bot (that's probably specialised to php or js).

We could also just use the standard transifex bot and upload json with icu plurals (the same plural method arb uses):

https://help.transifex.com/en/articles/6220806-json-with-icu-plurals

Or structured json https://help.transifex.com/en/articles/6220899-structured-json#h_a01d0d0054

That's the closest we can get to arb and when we don't use icu gender it could to some degree be just directly possible (I last checked this in janurary so I'm not that sure about all pf that anymore)

provokateurin commented 1 year ago

Ah yes I was only looking at the Nextcloud docs. I'm not sure if we can be easily included if we don't use the nextcloud-bot. I'll ask some people

provokateurin commented 1 year ago

Ok so we are free to do whatever we want. We can just use the standard transifex bot if we want.

I assume we will have a workflow like this: merge arbs (en) -> arb (en) -> json (en) -> transifex -> json ($lang) -> arb ($lang) -> split arbs ($lang). I think for the first half we could just automate it locally, but for the later half we need some CI so that the files get automatically updated when transifex does its work.

Leptopoda commented 1 year ago

I don't understand why we'd need the merge and split step.

Do you mean the different arb files like neon_news neon_core and so?

I think we should leave them separate. Thinking of cookbook we could use the original cookbook strings (and I don't think cookbook specific strings need to be in neon_core).

Iirc transifex allows creating groups like a neon group containing multiple projects.

provokateurin commented 1 year ago

I thought the merging was necessary because transifex might not support multiple files, but i assume that assumption is wrong. We can definitely copy the cookbook strings when support for that is added.

ceskyDJ commented 1 year ago

You can also just add your translations and someone else can regenerate the code for you.

Nice, it‘d be great. So, I‘ll look at it, when I have a piece of free time.

ceskyDJ commented 1 year ago

I'm so sorry for my inactivity, I still work on my bachelor thesis, so it's a little complicated with my free time. I promise I'll look at it soon.

provokateurin commented 1 year ago

Now that we are in the Nextcloud org we should really look into using Transifex to get help from the translation community. I don't think it makes sense to try to manually translate the current strings.

ceskyDJ commented 1 year ago

Oh, I'm so sorry. I didn't have enough time for translating all of your strings. So, should I wait for Transifex?

provokateurin commented 1 year ago

No problem at all! Yes, that would make the most sense I think

provokateurin commented 1 year ago

I think for developing a solution to get Transifex to work with ARB we should setup a separate repo (probably not in the Nextcloud org).