1.4.x: Trouble with "format_translation"/weblate

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

1.4.x: Trouble with "format_translation"/weblate

Felix Natter
Administrator
Dear devs,

there is a problem with merge conflicts of the translation files
(*.properties) if the sorting of the keys is different (or \ABCD instead
of \abcd etc.).

Therefore we have two gradle/ant tasks "check_translation" (which makes
the build fail if 'format_translation' needs to be executed) and
"format_translation" which actually normalizes the translation files
(mostly sorting, see above).

This has been working for a long time with the "pull" workflow:
- developer pulls from weblate (on 1.4.x)
- developer runs "gradle format_translation" and commits+pushes the
  result

However, recently we switched weblate to *push* the translation changes
to 1.4.x. Since this may change the ordering, "check_translation" may
fail at any time (not just when a developer pulls from weblate).

There are three solutions:

1. switch weblate back to pull mode

2. document that every developer needs to run "gradle
format_translation" and commit+push the result, even on fresh checkouts

3. format the translation files on weblate, requires more programming work.

What do you think?

Best Regards,
--
Felix Natter
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 1.4.x: Trouble with "format_translation"/weblate

Volker Börchers
Administrator
Hi,

principally nothing should be committed what is not ok; that would lead to switching back to pull mode. But I would find it acceptable to leave it to developers to fix format issues later. We could make it easier by integrating format translations (instead of only checking) into the build since it's up to the developers anyhow.

Regards, Volker

Am 28. März 2015 14:52:45 MEZ, schrieb "Felix Natter [via Freeplane Developer]" <[hidden email]>:
Dear devs,

there is a problem with merge conflicts of the translation files
(*.properties) if the sorting of the keys is different (or \ABCD instead
of \abcd etc.).

Therefore we have two gradle/ant tasks "check_translation" (which makes
the build fail if 'format_translation' needs to be executed) and
"format_translation" which actually normalizes the translation files
(mostly sorting, see above).

This has been working for a long time with the "pull" workflow:
- developer pulls from weblate (on 1.4.x)
- developer runs "gradle format_translation" and commits+pushes the
  result

However, recently we switched weblate to *push* the translation changes
to 1.4.x. Since this may change the ordering, "check_translation" may
fail at any time (not just when a developer pulls from weblate).

There are three solutions:

1. switch weblate back to pull mode

2. document that every developer needs to run "gradle
format_translation" and commit+push the result, even on fresh checkouts

3. format the translation files on weblate, requires more programming work.

What do you think?

Best Regards,
--
Felix Natter



If you reply to this email, your message will be added to the discussion below:
http://freeplane-developer.996965.n3.nabble.com/1-4-x-Trouble-with-format-translation-weblate-tp652.html
To start a new topic under Freeplane Developer, email [hidden email]
To unsubscribe from Freeplane Developer, click here.
NAML

Viele Grüße,
Volker
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 1.4.x: Trouble with "format_translation"/weblate

Dimitry Polivaev
Administrator
FYI

-------- Forwarded Message --------
Subject: Weblate git pre-commit hook
Date: Sun, 29 Mar 2015 19:55:25 +0200
From: Dimitry Polivaev
To: Michal Čihař

Hi Michal,

since we let Weblate to push new translations directly to our github repository it became more
important to be able to run a git precommit hook so that the translated files are formatted and
sorted in a way we need. We have already talked about it 2013. However I did not manage to implement
a separate java program because the formatter we use was strongly dependent on ant and it seemed too
hard to get it separate. And also we changed our build system to gradle recently.

So it would be great if it were possible to make a call to gradle in the pre-commit hook. It
requires only that gradle is available on your server. Could we do it this way?

Many thanks,
Dimitry Polivaev
Freeplane

On 08.04.2013 16:57, Michal Čihař wrote:

> Hi
>
> Dne Sun, 24 Feb 2013 10:37:41 +0100
> Dimitry Polivaev
>
>> To deal with issues b and c we used a special ant task which sorted and formatted the property so
>> that they such changes do not lead to conflicts. It also used to check the property ordering
>> formatting on each build. Because Weblate does not sort the properties and does not use our
>> formatting conventions I currently disabled this mechanism.
>>
>> Therefore I would like to ask you how weblate handles such issues and whether you find a good idea
>> to sort and format all properties before weblate commits them so that there is some standardized
>> order and format making conflict resolution easier.
>
> I've just implemented custom pre commit hooks [1], so if you can
> provide me some script which does your sorting it could be plugged in
> (it will take some days before I will deploy new version to production).
>
> [1]: https://github.com/nijel/weblate/issues/221
>


> Hi,
>
> principally nothing should be committed what is not ok; that would lead to switching back to pull
> mode. But I would find it acceptable to leave it to developers to fix format issues later. We could
> make it easier by integrating format translations (instead of only checking) into the build since
> it's up to the developers anyhow.
>
> Regards, Volker

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 1.4.x: Trouble with "format_translation"/weblate

Felix Natter
Administrator
In reply to this post by Volker Börchers
"Volker Börchers [via Freeplane Developer]"
<[hidden email]> writes:

> Hi,

hello Volker,

> principally nothing should be committed what is not ok; that would lead to
> switching back to pull mode.

IMHO this should be the next best solution if installing gradle on the
weblate server does not work.

> But I would find it acceptable to leave it to
> developers to fix format issues later. We could make it easier by
> integrating format translations (instead of only checking) into the build
> since it's up to the developers anyhow.

I do not agree with this. New devs will suddenly have uncommitted
changes after checkout/build and they don't know where they come from
(like with (2)).

Best Regards,
--
Felix Natter
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 1.4.x: Trouble with "format_translation"/weblate

Felix Natter
Administrator
In reply to this post by Dimitry Polivaev
"Dimitry Polivaev [via Freeplane Developer]"
<[hidden email]> writes:

> FYI

+1 !
--
Felix Natter
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 1.4.x: Trouble with "format_translation"/weblate

Volker Börchers
Administrator
In reply to this post by Dimitry Polivaev
Hi,

commit hooks would be the best solution. Ant/gradle would be nice but
they are not mandatory since it should be fairly easy to extract it to a
separate program or even use a perl script (one-liner?) instead.

Regards, Volker

Am 29.03.2015 um 19:56 schrieb Dimitry Polivaev [via Freeplane Developer]:

> FYI
>
> -------- Forwarded Message --------
> Subject: Weblate git pre-commit hook
> Date: Sun, 29 Mar 2015 19:55:25 +0200
> From: Dimitry Polivaev
> To: Michal Čihař
>
> Hi Michal,
>
> since we let Weblate to push new translations directly to our github
> repository it became more
> important to be able to run a git precommit hook so that the translated
> files are formatted and
> sorted in a way we need. We have already talked about it 2013. However I
> did not manage to implement
> a separate java program because the formatter we use was strongly
> dependent on ant and it seemed too
> hard to get it separate. And also we changed our build system to gradle
> recently.
>
> So it would be great if it were possible to make a call to gradle in the
> pre-commit hook. It
> requires only that gradle is available on your server. Could we do it
> this way?
>
> Many thanks,
> Dimitry Polivaev
> Freeplane
>
> On 08.04.2013 16:57, Michal Čihař wrote:
>
>  > Hi
>  >
>  > Dne Sun, 24 Feb 2013 10:37:41 +0100
>  > Dimitry Polivaev
>  >
>  >> To deal with issues b and c we used a special ant task which sorted
> and formatted the property so
>  >> that they such changes do not lead to conflicts. It also used to
> check the property ordering
>  >> formatting on each build. Because Weblate does not sort the
> properties and does not use our
>  >> formatting conventions I currently disabled this mechanism.
>  >>
>  >> Therefore I would like to ask you how weblate handles such issues
> and whether you find a good idea
>  >> to sort and format all properties before weblate commits them so
> that there is some standardized
>  >> order and format making conflict resolution easier.
>  >
>  > I've just implemented custom pre commit hooks [1], so if you can
>  > provide me some script which does your sorting it could be plugged in
>  > (it will take some days before I will deploy new version to production).
>  >
>  > [1]: https://github.com/nijel/weblate/issues/221
>  >
>
>
>  > Hi,
>  >
>  > principally nothing should be committed what is not ok; that would
> lead to switching back to pull
>  > mode. But I would find it acceptable to leave it to developers to fix
> format issues later. We could
>  > make it easier by integrating format translations (instead of only
> checking) into the build since
>  > it's up to the developers anyhow.
>  >
>  > Regards, Volker
>
>
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
> http://freeplane-developer.996965.n3.nabble.com/1-4-x-Trouble-with-format-translation-weblate-tp652p657.html
>
> To start a new topic under Freeplane Developer, email
> [hidden email]
> To unsubscribe from Freeplane Developer, click here
> <
> NAML
> <
http://freeplane-developer.996965.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 1.4.x: Trouble with "format_translation"/weblate

Dimitry Polivaev
Administrator
Hi Volker,

it would be nice if you could implement one of your suggestions. I failed.

Regards,
Dimitry

> Hi,
>
> commit hooks would be the best solution. Ant/gradle would be nice but
> they are not mandatory since it should be fairly easy to extract it to a
> separate program or even use a perl script (one-liner?) instead.
>
> Regards, Volker

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 1.4.x: Trouble with "format_translation"/weblate

Felix Natter
Administrator
"Dimitry Polivaev [via Freeplane Developer]"
<[hidden email]> writes:

hello,

I agree with Volker that the gradle solution would be much preferred.
I could easily write a perl/python script that sorts the properties
files alphabetically, but that is not all that "gradle
format_translation" does
(it has some more logic in the Comparator, normalizes EOLstyle, converts
unicode references to upper case and more)

> it would be nice if you could implement one of your suggestions. I failed.

What exactly failed? Trying to write a script or calling gradle on the
weblate server? What exactly is the problem?

--> I think we should switch back to pull mode if the gradle solution
fails.

Best Regards,
--
Felix Natter
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 1.4.x: Trouble with "format_translation"/weblate

Dimitry Polivaev
Administrator

-------- Forwarded Message --------
Subject: Fwd: Re: Weblate git pre-commit hook
Date: Thu, 02 Apr 2015 21:17:20 +0200
From: Dimitry Polivaev
To: Michal Čihař

Hello Michal,

could you please let me know if the gradle based solution can be applied? For us it would be the
favorite because it would allow us to continue to use our already implemented full solution.

Regards,

Dimitry


-------- Forwarded Message --------
Subject: Re: Weblate git pre-commit hook
Date: Tue, 31 Mar 2015 15:48:09 +0200
From: Dimitry Polivaev
To: Michal Čihař

 >> Everything we need to run is open source.
 >> How could we proceed?
 >
 > Can you put code which needs to be executed in a tarball so that it can
 > be executed standalone without the repository?
 >

Everything is a part of freeplane code base. We just need to run "gradle format_translation" from
the freeplane source root directory. This task is defined in the gradle scripts belonging to the
project, and its implementation uses an ant task which is implemented in subproject freeplane_ant
and it is compiled by gradle on demand.

What more do you need?

Regards,
Dimitry





Loading...