Re: [libreoffice-l10n] .src and .ui gettext migration

2017-07-13 Thread Caolán McNamara
On Thu, 2017-07-13 at 12:54 +0300, Mihkel Tõnnov wrote:
> Hi Caolán, *,
> 
> 2017-07-13 12:43 GMT+03:00 Caolán McNamara :
> 
> > [snip]
> > In our code I've autogenerated matching initial contexts for the
> > matching .ui and .hrc source strings.
> > 
> 
> Could you clarify what do you mean by that?

I'll take a pair of real examples:

Currently a .hrc/.src entry of SV_APP_CPUTHREADS

//in vcl/inc/svids.hrc
#define SV_APP_CPUTHREADS   10800

//in vcl/source/src/app.src
String SV_APP_CPUTHREADS
{
Text [en-US] = "CPU threads: ";
};

corresponding .po entry where the msgctxt is currently autogenerated on
extraction from .src to .po

msgctxt ""
"app.src\n"
"SV_APP_CPUTHREADS\n"
"string.text"
msgid "CPU threads: "
msgstr "something or other"

turns into

//in our source where the 1st arg is the context and all existing
//entries contexts are simply derived from the define name
#define SV_APP_CPUTHREADS NC_("SV_APP_CPUTHREADS", "CPU threads: ")

corresponding .po entry
msgctxt "SV_APP_CPUTHREADS"
msgid "CPU threads: "
msgstr "something or other"

and the msgctxt is no longer generated on export to .po just taken from
the source entry

The other case is .ui entries, they go from e.g.

//vcl/uiconfig/ui/printdialog.ui
Options

with a .po entry of

msgctxt ""
"printdialog.ui\n"
"label21\n"
"label\n"
"string.text"
msgid "Options"
msgstr "Optionen"

where the msgctxt is similarly autogenerated on export to .po

to...

//vcl/uiconfig/ui/printdialog.ui
Options

where the context/msgctxt for existing strings has been one-time
derived from the .ui filename and widget/object the string belong to

with a corresponding .po entry of

msgctxt "printdialog|label21"
msgid "Options"
msgstr "Optionen"

-- 
To unsubscribe e-mail to: l10n+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/l10n/
All messages sent to this list will be publicly archived and cannot be deleted


Re: [libreoffice-l10n] .src and .ui gettext migration

2017-07-13 Thread Mihkel Tõnnov
Hi Caolán, *,

2017-07-13 12:43 GMT+03:00 Caolán McNamara :

> [snip]
> In our code I've autogenerated matching initial contexts for the
> matching .ui and .hrc source strings.
>

Could you clarify what do you mean by that?

Best regards,
Mihkel
Estonian team

-- 
To unsubscribe e-mail to: l10n+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/l10n/
All messages sent to this list will be publicly archived and cannot be deleted


[libreoffice-l10n] .src and .ui gettext migration

2017-07-13 Thread Caolán McNamara
So, I'm pretty happy with my latest iteration of migrating to gettext
and I've got it up and running on all supported platforms.

backstory is https://lists.freedesktop.org/archives/libreoffice/2017-Ma
y/077818.html with the modification that we retain a msgctxt, albeit a
shorter one than the current pseudo msgctxt that is generated for the
current .po files

To try and minimize disruption I've a script available in master as
solenv/bin/update-for-gettext to update our current translations to
give them a new msgctxt (and update their keyid comment) 

I've successfully run this over the sample tarball of .pos extracted
from pootle that cloph provided. i.e.
python2 /path/solenv/bin/update-for-gettext translations/libo_ui
It shrinks and normalizes the msgctxt and updates the keyid comment for
.src and .ui strings and moves them into a per-module messages.po.

For .src strings the msgctxt typically becomes the 2nd line of the
current msgctxt i.e. the #define of the string or stringarry

For .ui strings the msgctxt typically becomes uifilename|widgetname

(caolanm->cloph: will this script suffice for getting pootle updated ?)

In our code I've autogenerated matching initial contexts for the
matching .ui and .hrc source strings.

(newly added strings can have arbitrary meaningful context strings
e.g. NC_("papersize", "A4") its just the existing ones that will have
ones mechanically generated from the existing metadata available)

Is there any outstanding concerns or questions.

-- 
To unsubscribe e-mail to: l10n+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/l10n/
All messages sent to this list will be publicly archived and cannot be deleted