Skip to content

Commit

Permalink
Update localization of IPP attribute/value pairs (Issue #5495)
Browse files Browse the repository at this point in the history
Note: This adds a cups_en.po file containing the real localized strings, with
cups.pot pulling from ipp-strings.c which is generated from the IANA IPP
registry.  Localizer comments are included to help translators do all of those
string...

After the "purge", all of the non-English localization files are well below the
90% goal for translating... :(
  • Loading branch information
michaelrsweet committed Jan 24, 2019
1 parent 7281649 commit fe0d611
Show file tree
Hide file tree
Showing 18 changed files with 69,721 additions and 31,022 deletions.
4 changes: 2 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Changes in CUPS v2.3b8
Everywhere printer differently, resulting in different PPDs for the same
printer (Issue #5484)
- Localization updates (Issue #5461, Issues #5471, Issue #5481, Issue #5486,
Issue #5489, Issue #5491, Issue #5492, Issue #5493, Issue #5494, Issue #5499,
Issue #5500, Issue #5501)
Issue #5489, Issue #5491, Issue #5492, Issue #5493, Issue #5494, Issue #5495,
Issue #5499, Issue #5500, Issue #5501)


Changes in CUPS v2.3b7
Expand Down
18 changes: 10 additions & 8 deletions locale/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,14 @@ install-data: $(INSTALL_LANGUAGES)

install-languages:
$(INSTALL_DIR) -m 755 $(LOCALEDIR)
for loc in $(LANGUAGES) ; do \
for loc in en $(LANGUAGES) ; do \
if test -f cups_$$loc.po; then \
$(INSTALL_DIR) -m 755 $(LOCALEDIR)/$$loc ; \
$(INSTALL_DATA) cups_$$loc.po $(LOCALEDIR)/$$loc/cups_$$loc.po ; \
fi ; \
done
$(INSTALL_DIR) -m 755 $(LOCALEDIR)/en
$(INSTALL_DATA) cups.pot $(LOCALEDIR)/en/cups_en.po

install-langbundle: po2strings
install-langbundle: cups.strings
$(INSTALL_DIR) -m 755 "$(BUILDROOT)$(RESOURCEDIR)"
$(INSTALL_DATA) cups.strings "$(BUILDROOT)$(RESOURCEDIR)"

Expand Down Expand Up @@ -109,7 +107,7 @@ install-libs:
uninstall: $(UNINSTALL_LANGUAGES)

uninstall-languages:
-for loc in $(LANGUAGES) ; do \
-for loc in en $(LANGUAGES) ; do \
$(RM) $(LOCALEDIR)/$$loc/cups_$$loc.po ; \
done

Expand All @@ -128,12 +126,12 @@ pot: checkpo po2strings
mv cups.pot cups.pot.bck
touch cups.pot
cd ..; xgettext -o locale/cups.pot -cTRANSLATORS -s \
--keyword=_ --no-wrap \
--keyword=_ --no-wrap --from-code utf-8 \
--copyright-holder="Apple Inc." \
--package-name="CUPS" --package-version="$(CUPS_VERSION)" \
--msgid-bugs-address="https://github.com/apple/cups/issues" \
*/*.c */*.cxx
(cat cups.header; tail +6 cups.pot; cat cups.footer) > cups.pot.N
(cat cups.header; tail +6 cups.pot) > cups.pot.N
mv cups.pot.N cups.pot
echo Checking cups.pot...
./checkpo cups.pot
Expand All @@ -145,7 +143,11 @@ pot: checkpo po2strings
msgmerge -o $$loc -s -N --no-location $$loc cups.pot ; \
done
echo Updating cups.strings...
./po2strings cups.pot cups.strings
./po2strings cups_en.po cups.strings

cups.strings: cups_en.po po2strings
echo Updating cups.strings...
./po2strings cups_en.po cups.strings


#
Expand Down
12 changes: 4 additions & 8 deletions locale/checkpo.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ main(int argc, /* I - Number of command-line args */
if (strstr(argv[i], ".strings"))
po = _cupsMessageLoad(argv[i], _CUPS_MESSAGE_STRINGS);
else
po = _cupsMessageLoad(argv[i], _CUPS_MESSAGE_PO);
po = _cupsMessageLoad(argv[i], _CUPS_MESSAGE_PO | _CUPS_MESSAGE_EMPTY);

if (!po)
{
Expand Down Expand Up @@ -156,7 +156,6 @@ main(int argc, /* I - Number of command-line args */
abbreviate(msg->msg, idbuf, sizeof(idbuf)));
}


if (!msg->str || !msg->str[0])
{
untranslated ++;
Expand Down Expand Up @@ -257,21 +256,18 @@ main(int argc, /* I - Number of command-line args */

if (pass)
{
if ((untranslated * 10) >= cupsArrayCount(po) &&
strcmp(argv[i], "cups.pot"))
if (untranslated >= (cupsArrayCount(po) / 10) && strcmp(argv[i], "cups.pot"))
{
/*
* Only allow 10% of messages to be untranslated before we fail...
*/

pass = 0;
puts("FAIL");
printf(" Too many untranslated messages (%d of %d)\n",
untranslated, cupsArrayCount(po));
printf(" Too many untranslated messages (%d of %d or %.1f%%)\n", untranslated, cupsArrayCount(po), 100.0 * untranslated / cupsArrayCount(po));
}
else if (untranslated > 0)
printf("PASS (%d of %d untranslated)\n", untranslated,
cupsArrayCount(po));
printf("PASS (%d of %d untranslated or %.1f%%)\n", untranslated, cupsArrayCount(po), 100.0 * untranslated / cupsArrayCount(po));
else
puts("PASS");
}
Expand Down
Loading

0 comments on commit fe0d611

Please sign in to comment.