cgeo / cgeo

c:geo - The powerful Android geocaching app.
www.cgeo.org
Apache License 2.0
1.39k stars 566 forks source link

online translation #2468

Closed koem closed 10 years ago

koem commented 11 years ago

title was: Translations: automatically include missing strings in values-*/strings.xml

I could write a script that reorders and updates all translation files (values-*/strings.xml):

idea 1 for output

  <string name="live_map_button">sOmE cRaZy JaPaNeSe SyMbOLs</string>
  <string name="caches_nearby_button">Nearby</string> <!-- please translate me! and delete this comment then ->
  <string name="advanced_search_button">sOmE oTheR cRaZy JaPaNeSe SyMbOLs</string>

idea 2 for output

  <string name="live_map_button">sOmE cRaZy JaPaNeSe SyMbOLs</string>
  <string name="translate_me__caches_nearby_button">Nearby</string>
  <string name="advanced_search_button">sOmE oTheR cRaZy JaPaNeSe SyMbOLs</string>

Pro:

Contra:

mucek4 commented 11 years ago

Make 2 scripts. 1st to make a temp file with only missing translations (from currently translated version and english version) 2nd to make a final translation file ordered correctly.

koem commented 11 years ago

1st script is there since a year or so: findmissingtranslations.sh :)

samueltardieu commented 11 years ago

The strings are globally in order, so I don't expect a huge reordering if you do so.

However, please do not include valid XML strings with untranslated versions even with mangled, symbols. You can include XML comments though:

<!-- untranslated <string name="caches_nearby_button">Nearby</string> -->

This way, one can run the script, then look for "untranslated" in the text editor and translate the strings.

Ideally, we should also use a commit hook to prevent XML files with "<!-- untranslated" from being committed.

koem commented 11 years ago

Great idea!

But the commit hook is a bit too harsh:

missing translations: cs: 61 da: 711 de: 7 es: 287 fr: 123 hu: 97 it: 75 ja: 64 nb: 619 nl: 176 pl: 72 pt: 96 sk: 94 sv: 202

But: these numbers are only correct if the corresponding file is in the same order as the english file. Linux diff...

samueltardieu commented 11 years ago

But the commit hook is a bit too harsh

Why? It would only prevent committing untranslated strings. People choosing to translate only a few strings would have to use partial commits (git add -p for example).

koem commented 11 years ago

we are just chatting about that in the irc... wanna join?

koem commented 11 years ago

summary from irc-chat: (http://shorty.pfc-clan.de/logs/cgeo/2013-02-11.txt from 09:11:05 to 10:28:55)

does anyone know who the translators are and how we can tell them?

ckroehnert commented 11 years ago

You could include a message (how they could use the scripts) in the top of each string file, so they will see it at the next fetch/merge.

Bananeweizen commented 11 years ago

Good that you avoided adding valid strings. Cause some people like me rely on having the missing strings shown by Android lint instead of some shell script. That would have been broken otherwise.

+1 for a reordering script. That not only makes it easier to compare files, but it also allows to rename/move strings in the English file and then to have them moved accordingly in the other files. Until now I've avoided such ID cleanups just for that reason.

SammysHP commented 11 years ago

Recently I found this service: https://webtranslateit.com/ Well, it's not free, but it can import, handle and export Android string resource files. Such a service is much more simple than our experiments with scripts. Does anyone know a free (web)tool like webtranslateit?

YraFyra commented 11 years ago

What about http://crowdin.net ? I'm involved in a translation there, and it is very easy to use for contributors.

RomNexus6 commented 11 years ago

koem asked about knowing translators name. I'm the one who did the IT. Add me to your list.

koem commented 11 years ago

ok, I'll check crowdin.net. It's free for open source.

koem commented 11 years ago

crowdin:

Very nice collaboration tool. Good layout, good workflows, but:

Because of the first contra -> I will send them a "bug report"

If someone wants to look at my test project: http://crowdin.net/project/koem-crowdin-test/de Then "translate" and then you can see all the strings (red dot) which are translated but shown as not translated

koem commented 11 years ago

reply mail from github - I asked them if they plan to make their own online translation feature:

Hi Köm,

Thanks for your feedback! We're always working to improve GitHub and we consider every suggestion we receive. I've added your idea about international translations to the Feature Request List™ for the team to see. The time is probably right for us to start looking at this for the future.

Thanks, -Austin

koem commented 11 years ago

@YraFyra: crowdin is now one of the TOP 2 of all the systems I checked (details later). What is your workflow with crowdin? How to you get your language files back into your repository? And how do you get your language files into crowdin if there are changes made not using crowdin?

YraFyra commented 11 years ago

I have only used Crowdin as a contributor, ie in GpsStatus. It is very easy to translation as you get a suggested text by Bing. Integration wih github should be able to get using some regular Jenkins job to download translations and git push...

Bananeweizen commented 11 years ago

I've also used crowdin today and it felt quite nice. If you want to test for yourself and actually contribute to a (non open source) project, then look at the translations for http://project-gc.com/ and try to fix them, whenever you see some bad translation on the website of that project.

Translation link: http://crowdin.net/project/Project-GC

koem commented 11 years ago

Progress update / status: I think I've tested all major systems out there now. The two in focus are:

a) crowdin: really good interface and free for open source projects. No github integration, but API for use with wget and curl. One drawback: download of translated files only every 30 mins.

b) weblate: ugly but with git integration. Demo page online. Has to be installed on server. Every single translated string leads to a commit (I read somewhere). Couldn't install it on my machine, too many dependencies. Does someone wants to give it a try and install it?

I like crowdin.

But we (me) need to script up and downloading+commiting of files - no problem.

But we also need to trigger some things - upload when there is a new version of english strings.xml / and maybe trigger manually the download of new translations, or just cron it. can we do this?

Bananeweizen commented 11 years ago

Yes we can. Crowdin has a huge API: http://crowdin.net/page/api. And that API can be handled by a small command line client: http://crowdin.net/page/cli-tool

So we can easily create some script around that. For the automation I would simply use the existing Jenkins server. Have a time triggered job to fetch new translations from Crowdin and to push them directly to git. Have another job to upload all translation files, which is automatically invoked after each change on our repository.

To make things not too complicated, I suggest we run this in 3 defined steps:

SammysHP commented 11 years ago

One suggestion: IMHO it's better to push new translation into a separate repository and automatically create a pull request. So we can review the changes, they are checked by Jenkins and if nobody merges the changes for some days additional commits will be appended to the existing pull request.

koem commented 11 years ago

I set up the project already.

We should only automatically upload english strings.xml automatically. For the other language strings.xml files we must decide if we want to edit them in crowdin OR in git. Both crowdin AND git is not good (merging). German => git. French => ?. Spanish => crowdin, ...

I can do all that, but right now I want to work on issue 750 (Settings screen).

When done, we should ask for translators on facebook.

And we could need some english natives, to check our german influenced english strings...

SammysHP commented 11 years ago

We need a solution that pulls from git each time somebody wants to change something.

Bananeweizen commented 11 years ago

We need a solution that pulls from git each time somebody wants to change something.

I don't think so. As koem wrote above, if we have exactly one direction per language, everything is easy to manage. And I would agree that we should translate English and German in git only, every other language in crowdin only. Now two way merging by default

Of course, that still allows a developer to manually merge an Italian translation update in git.

SammysHP commented 11 years ago

What if somebody sends us a pull request with English and another language different than German (together with e.g. a new feature implementation)?

Bananeweizen commented 11 years ago

I don't know the crowdin system myself that much, but I guess that we can upload single files at any time. Therefore in that case I would first review the open changes in crowdin and merge them into the repo, and then merge the pull request. By that order we should always see the conflicts directly in the pull request and can solve them on the git side.

Honestly, I also don't know if that works well or not. I think we should just try it. If there are a lot of problems, we have to solve them then. But maybe such conflicts occur very seldom, then we don't need to have a perfect solution for this case.

koem commented 11 years ago

Yes, that's how it works if we get translations via git. Download, merge, upload. But once a language is in crowdin, we shouldn't do translations in git anymore for that language. But there are sometime things you can only do on your dev machine, like renamings (find & replace).

I set up the project. Just one language now - spanish. If you want to do something: login, search for c:geo and join. I don't know about rights for users yet. I don't want anyone to have administrator rights. So let's see how that works.

koem commented 11 years ago

@Bananeweizen : the cli-tool is crap I think. At least on my machine, the ruby version didn't work and the java version took more than a minute to load. But with wget and curl I was able to do everything fast.

Bananeweizen commented 11 years ago

As it is not really possible to just join a project, the easiest way to get c:geo into your own list of projects is

Afterwards c:geo will be in your personal list.

Bananeweizen commented 11 years ago

@koem Do you have access to the Jenkins server? Or do you want to create the script part as such and then @mucek4 or I can create a job on Jenkins (including triggers by commits or pull requests and all that stuff).

koem commented 11 years ago

@Bananeweizen No, I dont have access to the server. But I think I can create the scripts on my laptop and then someone can put them there.

But not in the next 2-3 weeks - wanna finish work on settings first.

koem commented 11 years ago

@Bananeweizen, @rsudev I gave you the status of a proofreader. Can you manage the project settings now? http://crowdin.net/project/cgeo/settings

rsudev commented 11 years ago

@koem No, I can't

koem commented 11 years ago

from crowdin support, just to keep the information:

Yes, you surely can add more managers to your project the following way:

  1. Login to Crowdin;
  2. Choose "Resources" tab from the head menu;
  3. Select "Managers" option from the dialog that will appear; 4.Press "Add manager" button;
  4. Enter emails of people you want to manage your project.

so @rsudev @Bananeweizen - I need the mail addresses, you used to log in to crowdin -> spam ät petoria punkt deutschland

rsudev commented 11 years ago

Now I am a 'manager' and can see/change the settings, thanks. BTW, I think we could even put German translation to Crowdin. It might be easier WRT string re-ordering, changed/new source strings and stuff like that. And there might be other translators that can benefit from the presence of the German translation.

Lineflyer commented 11 years ago

Do I need to be a manager to contribute? I don't think so, so I will stay a "normal user" unless I could do something useful on crowdin to support the translation work.

rsudev commented 11 years ago

No, you don't. Everybody can contribute currently. Once we are set-up we can spread the word and hopefully get some more up-to-date translations. In our company even English is a 'translated' language, that is created from the developer-English by native speakers. Perhaps we can at some time move to such a work flow as well.

Lineflyer commented 11 years ago

In our company even English is a 'translated' language, that is created from the developer-English by native speakers.

Could be useful indeed :)

samueltardieu commented 11 years ago

@koem Could you add me as well?

koem commented 11 years ago

Add german: that actually is also not such a bad idea. We should give it a try when the self made git integration is set up. The original title of this issue was something with "finding missing translations"

koem commented 11 years ago

Add english: this is an amazing and idiot proof idea! we need a base language in crowdin. This can only be dev-english (values/strings.xml) . But a second real English is values-en/strings.xml then. When it lacks some translations every now and then, android will grab them from dev-english file!

Lineflyer commented 11 years ago

One remark: If possible we should include the PlayStore description as well. Currently this is done in

https://github.com/cgeo/cgeo/wiki/App-description-for-PlayStore https://github.com/cgeo/cgeo/wiki/Plugin-description-for-PlayStore

which is not very nice in terms of processing it.

koem commented 11 years ago

reminder: check what happens when new values/strings.xml is uploaded with changed texts. Will crowdin mark the translations for which the english text has changed?

samueltardieu commented 11 years ago

Note that this should not happen. Or only for cosmetic change with no semantic change.

RomNexus6 commented 11 years ago

I'm sorry, but I don't understand what happened. Is c:geo translation available on crowdin or must we translate by git as before? thanks.

Bananeweizen commented 11 years ago

@RomNexus6 We are in the transition phase, somehow. We have a project setup on crowdin, but we don't have the scripts for automatically merging those translations ready. So until we announce a change, translation via git is still perfectly fine.

koem commented 11 years ago

I'm gonna start writing the scripts now. Any special wishes?

Script 1: upload new values/strings.xml

Script 2: package and download translations (values-*/strings.xml)

SammysHP commented 11 years ago

No, only pull request.

koem commented 11 years ago

Scripts are done. There is one thing left: uploading changed language files (values-*/strings.xml) to crowdin (automatically).

I can only think of these not so cool solutions:

SammysHP commented 11 years ago

Translators usually live in other timezones. ;)