i18ndude: wrap long lines

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

i18ndude: wrap long lines

Maurits van Rees-3
Hi,

I have committed changes for i18ndude that wrap long lines in msgids and
msgstrs, as most PO editors do that.  See this issue:
https://github.com/collective/i18ndude/issues/3

You can switch this off to get the original behavior back by setting an
environment variable when calling i18ndude:

PO_MAX_WIDTH=0 i18ndude ...

(This could be made a proper command line option, but it seems best to
first refactor the script to using argparse instead of directly reading
sys.argv in all the commands.)


Question: does anyone foresee problems with this change for the core
Plone translations?

Of course the first time this new version is used you would get a really
long diff.  After that it should be fine.  If a translator keeps
everything on one line or does not manually split the lines perfectly
(which is probably hard without a custom po editor), then the next time
i18ndude is called it will shift some words to other lines, giving more
line differences.  On the plus side, someone fixes a typo in a long
msgid or msgstr, this is easier to notice in a 80 character line than in
a 1000 character line.


On another note, the current release 3.2.2 is almost three years old, so
a new release would be good.  From the changelog since then:

- Wrap msgid and msgstr lines at 79 characters, as most PO editors do
   that.  Set an environment variable ``PO_MAX_WIDTH`` to choose a
   different length.  If this is two or less, we do no wrapping,
   because all lines must be enclosed in quotes.
   https://github.com/collective/i18ndude/issues/3
   [maurits]

- Return exit code 1 when the called function gives an error.  This
   currently only has an effect when calling ``find-untranslated``.
   https://github.com/collective/i18ndude/issues/1
   [maurits]

- Moved code to https://github.com/collective/i18ndude
   [maurits]

- Backslash escape added to msgid when it includes double quotes.
   [taito]

- Add trmerge command to merge po files. Custom tailored for transifex.
   [do3cc]


Could I get release rights on pypi and plone.org?  My username is
maurits in both cases.  PyPI owners are: hannosch, nouri, vincentfretin.
  Or make a release yourself at your convenience.

Best,

--
Maurits van Rees: http://maurits.vanrees.org/
Zest Software: http://zestsoftware.nl


------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
_______________________________________________
Plone-i18n mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-i18n
Reply | Threaded
Open this post in threaded view
|

Re: i18ndude: wrap long lines

Vincent Fretin
Hi Maurits,

The change is ok for me. You are now owner on pypi.

Vincent Fretin
Ecreall
http://www.ecreall.com


On Sat, Sep 7, 2013 at 4:29 PM, Maurits van Rees <[hidden email]> wrote:
Hi,

I have committed changes for i18ndude that wrap long lines in msgids and
msgstrs, as most PO editors do that.  See this issue:
https://github.com/collective/i18ndude/issues/3

You can switch this off to get the original behavior back by setting an
environment variable when calling i18ndude:

PO_MAX_WIDTH=0 i18ndude ...

(This could be made a proper command line option, but it seems best to
first refactor the script to using argparse instead of directly reading
sys.argv in all the commands.)


Question: does anyone foresee problems with this change for the core
Plone translations?

Of course the first time this new version is used you would get a really
long diff.  After that it should be fine.  If a translator keeps
everything on one line or does not manually split the lines perfectly
(which is probably hard without a custom po editor), then the next time
i18ndude is called it will shift some words to other lines, giving more
line differences.  On the plus side, someone fixes a typo in a long
msgid or msgstr, this is easier to notice in a 80 character line than in
a 1000 character line.


On another note, the current release 3.2.2 is almost three years old, so
a new release would be good.  From the changelog since then:

- Wrap msgid and msgstr lines at 79 characters, as most PO editors do
   that.  Set an environment variable ``PO_MAX_WIDTH`` to choose a
   different length.  If this is two or less, we do no wrapping,
   because all lines must be enclosed in quotes.
   https://github.com/collective/i18ndude/issues/3
   [maurits]

- Return exit code 1 when the called function gives an error.  This
   currently only has an effect when calling ``find-untranslated``.
   https://github.com/collective/i18ndude/issues/1
   [maurits]

- Moved code to https://github.com/collective/i18ndude
   [maurits]

- Backslash escape added to msgid when it includes double quotes.
   [taito]

- Add trmerge command to merge po files. Custom tailored for transifex.
   [do3cc]


Could I get release rights on pypi and plone.org?  My username is
maurits in both cases.  PyPI owners are: hannosch, nouri, vincentfretin.
  Or make a release yourself at your convenience.

Best,

--
Maurits van Rees: http://maurits.vanrees.org/
Zest Software: http://zestsoftware.nl


------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
_______________________________________________
Plone-i18n mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-i18n


------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
_______________________________________________
Plone-i18n mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-i18n
Reply | Threaded
Open this post in threaded view
|

Re: i18ndude: wrap long lines

Maurits van Rees-3
Thanks, Vincent.

I do notice that this change would make it harder to search for not yet
translated msgstrs in a po file.  I normally search for 'msgstr ""' in
my Emacs editor to find those, but with this change this would now also
find all multi-line translations.  Trying it in p.a.locales master:

$ grep -c 'msgstr ""' fr/LC_MESSAGES/plone.po
3
$ i18ndude sync --pot plone.pot fr/LC_MESSAGES/plone.po
fr/LC_MESSAGES/plone.po: 0 added, 0 removed
$ grep -c 'msgstr ""' fr/LC_MESSAGES/plone.po
359

For example, this is the original:

#: CMFPlone/skins/plone_scripts/check_id.py:81
msgid "${name} is not a legal name. The following characters are
invalid: ${characters}"
msgstr "${name} n'est pas un nom valide. Les caractères suivants sont
non valides : ${characters}"

and this would be the new contents:

#: CMFPlone/skins/plone_scripts/check_id.py:81
msgid ""
"${name} is not a legal name. The following characters are invalid: "
"${characters}"
msgstr ""
"${name} n'est pas un nom valide. Les caractères suivants sont non
valides : "
"${characters}"

This is how it should be when you wrap those lines so this is good, but
not being able to search well could be a downside.

I have not made a release yet.  Especially with the above in mind I
would want to make the wrapping a command line option so it is easier to
switch off.  And I intend to show a bit more information on the PyPI page.

Best,

Maurits


Op 07-09-13 16:39, Vincent Fretin schreef:

> Hi Maurits,
>
> The change is ok for me.. You are now owner on pypi.
>
> Vincent Fretin
> Ecreall
> http://www.ecreall.com
>
>
> On Sat, Sep 7, 2013 at 4:29 PM, Maurits van Rees
> <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hi,
>
>     I have committed changes for i18ndude that wrap long lines in msgids and
>     msgstrs, as most PO editors do that.  See this issue:
>     https://github.com/collective/i18ndude/issues/3
>
>     You can switch this off to get the original behavior back by setting an
>     environment variable when calling i18ndude:
>
>     PO_MAX_WIDTH=0 i18ndude ...
>
>     (This could be made a proper command line option, but it seems best to
>     first refactor the script to using argparse instead of directly reading
>     sys.argv in all the commands.)
>
>
>     Question: does anyone foresee problems with this change for the core
>     Plone translations?
>
>     Of course the first time this new version is used you would get a really
>     long diff.  After that it should be fine.  If a translator keeps
>     everything on one line or does not manually split the lines perfectly
>     (which is probably hard without a custom po editor), then the next time
>     i18ndude is called it will shift some words to other lines, giving more
>     line differences.  On the plus side, someone fixes a typo in a long
>     msgid or msgstr, this is easier to notice in a 80 character line than in
>     a 1000 character line.
>
>
>     On another note, the current release 3.2.2 is almost three years old, so
>     a new release would be good.  From the changelog since then:
>
>     - Wrap msgid and msgstr lines at 79 characters, as most PO editors do
>         that.  Set an environment variable ``PO_MAX_WIDTH`` to choose a
>         different length.  If this is two or less, we do no wrapping,
>         because all lines must be enclosed in quotes.
>     https://github.com/collective/i18ndude/issues/3
>         [maurits]
>
>     - Return exit code 1 when the called function gives an error.  This
>         currently only has an effect when calling ``find-untranslated``.
>     https://github.com/collective/i18ndude/issues/1
>         [maurits]
>
>     - Moved code to https://github.com/collective/i18ndude
>         [maurits]
>
>     - Backslash escape added to msgid when it includes double quotes.
>         [taito]
>
>     - Add trmerge command to merge po files. Custom tailored for transifex.
>         [do3cc]
>
>
>     Could I get release rights on pypi and plone.org <http://plone.org>?
>       My username is
>     maurits in both cases.  PyPI owners are: hannosch, nouri, vincentfretin.
>        Or make a release yourself at your convenience.
>
>     Best,
>
>     --
>     Maurits van Rees: http://maurits.vanrees.org/
>     Zest Software: http://zestsoftware.nl
>
>
>     ------------------------------------------------------------------------------
>     Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
>     Discover the easy way to master current and previous Microsoft
>     technologies
>     and advance your career. Get an incredible 1,500+ hours of step-by-step
>     tutorial videos with LearnDevNow. Subscribe today and save!
>     http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
>     _______________________________________________
>     Plone-i18n mailing list
>     [hidden email]
>     <mailto:[hidden email]>
>     https://lists.sourceforge.net/lists/listinfo/plone-i18n
>
>
>
>
> ------------------------------------------------------------------------------
> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> Discover the easy way to master current and previous Microsoft technologies
> and advance your career. Get an incredible 1,500+ hours of step-by-step
> tutorial videos with LearnDevNow. Subscribe today and save!
> http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
>
>
>
> _______________________________________________
> Plone-i18n mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/plone-i18n
>


--
Maurits van Rees: http://maurits.vanrees.org/
Zest Software: http://zestsoftware.nl


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Plone-i18n mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-i18n
Reply | Threaded
Open this post in threaded view
|

Re: i18ndude: wrap long lines

Vincent Fretin
Hi,

Emacs can have a po mode, a quick search give me
http://www.emacswiki.org/emacs/PoMode

I use poedit.

Vincent


On Wed, Sep 11, 2013 at 10:32 PM, Maurits van Rees <[hidden email]> wrote:
Thanks, Vincent.

I do notice that this change would make it harder to search for not yet
translated msgstrs in a po file.  I normally search for 'msgstr ""' in
my Emacs editor to find those, but with this change this would now also
find all multi-line translations.  Trying it in p.a.locales master:

$ grep -c 'msgstr ""' fr/LC_MESSAGES/plone.po
3
$ i18ndude sync --pot plone.pot fr/LC_MESSAGES/plone.po
fr/LC_MESSAGES/plone.po: 0 added, 0 removed
$ grep -c 'msgstr ""' fr/LC_MESSAGES/plone.po
359

For example, this is the original:

#: CMFPlone/skins/plone_scripts/check_id.py:81
msgid "${name} is not a legal name. The following characters are
invalid: ${characters}"
msgstr "${name} n'est pas un nom valide. Les caractères suivants sont
non valides : ${characters}"

and this would be the new contents:

#: CMFPlone/skins/plone_scripts/check_id.py:81
msgid ""
"${name} is not a legal name. The following characters are invalid: "
"${characters}"
msgstr ""
"${name} n'est pas un nom valide. Les caractères suivants sont non
valides : "
"${characters}"

This is how it should be when you wrap those lines so this is good, but
not being able to search well could be a downside.

I have not made a release yet.  Especially with the above in mind I
would want to make the wrapping a command line option so it is easier to
switch off.  And I intend to show a bit more information on the PyPI page.

Best,

Maurits


Op 07-09-13 16:39, Vincent Fretin schreef:
> Hi Maurits,
>
> The change is ok for me.. You are now owner on pypi.
>
> Vincent Fretin
> Ecreall
> http://www.ecreall.com
>
>
> On Sat, Sep 7, 2013 at 4:29 PM, Maurits van Rees
> <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hi,
>
>     I have committed changes for i18ndude that wrap long lines in msgids and
>     msgstrs, as most PO editors do that.  See this issue:
>     https://github.com/collective/i18ndude/issues/3
>
>     You can switch this off to get the original behavior back by setting an
>     environment variable when calling i18ndude:
>
>     PO_MAX_WIDTH=0 i18ndude ...
>
>     (This could be made a proper command line option, but it seems best to
>     first refactor the script to using argparse instead of directly reading
>     sys.argv in all the commands.)
>
>
>     Question: does anyone foresee problems with this change for the core
>     Plone translations?
>
>     Of course the first time this new version is used you would get a really
>     long diff.  After that it should be fine.  If a translator keeps
>     everything on one line or does not manually split the lines perfectly
>     (which is probably hard without a custom po editor), then the next time
>     i18ndude is called it will shift some words to other lines, giving more
>     line differences.  On the plus side, someone fixes a typo in a long
>     msgid or msgstr, this is easier to notice in a 80 character line than in
>     a 1000 character line.
>
>
>     On another note, the current release 3.2.2 is almost three years old, so
>     a new release would be good.  From the changelog since then:
>
>     - Wrap msgid and msgstr lines at 79 characters, as most PO editors do
>         that.  Set an environment variable ``PO_MAX_WIDTH`` to choose a
>         different length.  If this is two or less, we do no wrapping,
>         because all lines must be enclosed in quotes.
>     https://github.com/collective/i18ndude/issues/3
>         [maurits]
>
>     - Return exit code 1 when the called function gives an error.  This
>         currently only has an effect when calling ``find-untranslated``.
>     https://github.com/collective/i18ndude/issues/1
>         [maurits]
>
>     - Moved code to https://github.com/collective/i18ndude
>         [maurits]
>
>     - Backslash escape added to msgid when it includes double quotes.
>         [taito]
>
>     - Add trmerge command to merge po files. Custom tailored for transifex.
>         [do3cc]
>
>
>     Could I get release rights on pypi and plone.org <http://plone.org>?
>       My username is
>     maurits in both cases.  PyPI owners are: hannosch, nouri, vincentfretin.
>        Or make a release yourself at your convenience.
>
>     Best,
>
>     --
>     Maurits van Rees: http://maurits.vanrees.org/
>     Zest Software: http://zestsoftware.nl
>
>
>     ------------------------------------------------------------------------------
>     Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
>     Discover the easy way to master current and previous Microsoft
>     technologies
>     and advance your career. Get an incredible 1,500+ hours of step-by-step
>     tutorial videos with LearnDevNow. Subscribe today and save!
>     http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
>     _______________________________________________
>     Plone-i18n mailing list
>     [hidden email]
>     <mailto:[hidden email]>
>     https://lists.sourceforge.net/lists/listinfo/plone-i18n
>
>
>
>
> ------------------------------------------------------------------------------
> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> Discover the easy way to master current and previous Microsoft technologies
> and advance your career. Get an incredible 1,500+ hours of step-by-step
> tutorial videos with LearnDevNow. Subscribe today and save!
> http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
>
>
>
> _______________________________________________
> Plone-i18n mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/plone-i18n
>


--
Maurits van Rees: http://maurits.vanrees.org/
Zest Software: http://zestsoftware.nl


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Plone-i18n mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-i18n


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Plone-i18n mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-i18n