Corrected Language Codes The Gnu document incorrectly listed Japanese as jp and Hebrew as iw. That was why the Plurals line passed through directly from the template.

This commit is contained in:
Adam Young 2010-09-28 17:27:01 -04:00
parent c106922c13
commit 58f1026e34
5 changed files with 303 additions and 23 deletions

View File

@ -3,9 +3,9 @@ de
es
fr
id
he
it
iw
jp
ja
kn
ko
pl

286
install/po/Makefile Normal file
View File

@ -0,0 +1,286 @@
prefix = /usr
exec_prefix = ${prefix}
datarootdir = ${prefix}/share
datadir = ${datarootdir}
localedir = ${datarootdir}/locale
INSTALL = /usr/bin/install -c
INSTALL_DATA = /usr/bin/install -c -m 644
AWK = gawk
SED = /bin/sed
MKDIR_P = /bin/mkdir -p
XGETTEXT = /usr/bin/xgettext
MSGFMT = /usr/bin/msgfmt
MSGINIT = /usr/bin/msginit
MSGMERGE = /usr/bin/msgmerge
MSGCMP = /usr/bin/msgcmp
DOMAIN = ipa
MSGMERGE_UPDATE = $(MSGMERGE) --update
COPYRIGHT_HOLDER = Red Hat
PACKAGE_NAME = $(DOMAIN)
PACKAGE_BUGREPORT = https://hosted.fedoraproject.org/projects/freeipa/newticket
XGETTEXT_OPTIONS = \
--add-comments="TRANSLATORS:" \
--copyright-holder="$(COPYRIGHT_HOLDER)" \
--package-name="$(PACKAGE_NAME)" \
--msgid-bugs-address="$(PACKAGE_BUGREPORT)"
languages = $(shell $(SED) 's/\#.*//' LINGUAS) # The sed command removes comments
po_files = $(patsubst %, %.po, $(languages))
mo_files = $(patsubst %.po, %.mo, $(po_files))
po_count=$(words $(po_files))
PYTHON_POTFILES = \
../../ipa \
../../lite-server.py \
../../ipapython/config.py \
../../ipapython/sysrestore.py \
../../ipapython/__init__.py \
../../ipapython/ipautil.py \
../../ipapython/certdb.py \
../../ipapython/ipavalidate.py \
../../ipapython/dnsclient.py \
../../ipapython/dogtag.py \
../../ipapython/nsslib.py \
../../ipapython/entity.py \
../../install/tools/ipa-replica-manage \
../../install/tools/ipa-server-certinstall \
../../install/tools/ipa-replica-install \
../../install/tools/ipa-nis-manage \
../../install/tools/ipa-upgradeconfig \
../../install/tools/ipa-replica-prepare \
../../install/tools/ipa-compat-manage \
../../install/tools/ipa-server-install \
../../install/tools/ipa-ldap-updater \
../../install/migration/migration.py \
../../ipalib/config.py \
../../ipalib/parameters.py \
../../ipalib/request.py \
../../ipalib/output.py \
../../ipalib/__init__.py \
../../ipalib/backend.py \
../../ipalib/pkcs10.py \
../../ipalib/x509.py \
../../ipalib/plugable.py \
../../ipalib/constants.py \
../../ipalib/aci.py \
../../ipalib/base.py \
../../ipalib/ipauuid.py \
../../ipalib/crud.py \
../../ipalib/cli.py \
../../ipalib/text.py \
../../ipalib/compat.py \
../../ipalib/frontend.py \
../../ipalib/rpc.py \
../../ipalib/errors.py \
../../ipalib/encoder.py \
../../ipalib/util.py \
../../ipalib/plugins/config.py \
../../ipalib/plugins/rolegroup.py \
../../ipalib/plugins/host.py \
../../ipalib/plugins/group.py \
../../ipalib/plugins/migration.py \
../../ipalib/plugins/xmlclient.py \
../../ipalib/plugins/service.py \
../../ipalib/plugins/passwd.py \
../../ipalib/plugins/__init__.py \
../../ipalib/plugins/virtual.py \
../../ipalib/plugins/hbac.py \
../../ipalib/plugins/cert.py \
../../ipalib/plugins/baseldap.py \
../../ipalib/plugins/aci.py \
../../ipalib/plugins/kerberos.py \
../../ipalib/plugins/krbtpolicy.py \
../../ipalib/plugins/dns.py \
../../ipalib/plugins/automount.py \
../../ipalib/plugins/netgroup.py \
../../ipalib/plugins/misc.py \
../../ipalib/plugins/user.py \
../../ipalib/plugins/taskgroup.py \
../../ipalib/plugins/hostgroup.py \
../../ipalib/plugins/pwpolicy.py \
../../ipalib/plugins/internal.py \
../../ipaserver/__init__.py \
../../ipaserver/servercore.py \
../../ipaserver/ipautil.py \
../../ipaserver/rpcserver.py \
../../ipaserver/conn.py \
../../ipaserver/ipaldap.py \
../../ipaserver/install/installutils.py \
../../ipaserver/install/service.py \
../../ipaserver/install/ldapupdate.py \
../../ipaserver/install/__init__.py \
../../ipaserver/install/cainstance.py \
../../ipaserver/install/ntpinstance.py \
../../ipaserver/install/bindinstance.py \
../../ipaserver/install/krbinstance.py \
../../ipaserver/install/certs.py \
../../ipaserver/install/dsinstance.py \
../../ipaserver/install/replication.py \
../../ipaserver/install/httpinstance.py \
../../ipaserver/plugins/ldap2.py \
../../ipaserver/plugins/rabase.py \
../../ipaserver/plugins/selfsign.py \
../../ipaserver/plugins/__init__.py \
../../ipaserver/plugins/join.py \
../../ipaserver/plugins/ldapapi.py \
../../ipaserver/plugins/xmlserver.py \
../../ipaserver/plugins/dogtag.py \
../../contrib/RHEL4/ipachangeconf.py \
../../ipa-client/ipaclient/ntpconf.py \
../../ipa-client/ipaclient/__init__.py \
../../ipa-client/ipaclient/ipachangeconf.py \
../../ipa-client/ipaclient/ipadiscovery.py \
../../ipa-client/ipa-install/ipa-client-install
C_POTFILES = \
../../daemons/ipa-kpasswd/ipa_kpasswd.c \
../../daemons/ipa-slapi-plugins/ipa-enrollment/ipa_enrollment.c \
../../daemons/ipa-slapi-plugins/ipa-memberof/ipa-memberof.c \
../../daemons/ipa-slapi-plugins/ipa-memberof/ipa-memberof.h \
../../daemons/ipa-slapi-plugins/ipa-memberof/ipa-memberof_config.c \
../../daemons/ipa-slapi-plugins/ipa-pwd-extop/ipa_pwd_extop.c \
../../daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync-config.c \
../../daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync.c \
../../daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync.h \
../../ipa-client/config.c \
../../ipa-client/ipa-getkeytab.c \
../../ipa-client/ipa-join.c \
../../ipa-client/ipa-rmkeytab.c
POTFILES = $(PYTHON_POTFILES) $(C_POTFILES)
.SUFFIXES:
.SUFFIXES: .po .mo
.PHONY: all create-po update-po update-pot install mostlyclean clean distclean test_lang test mo-files
all:
SUFFIXES = .po .mo
.po.mo:
@echo Creating $@; \
$(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
$(po_files): $(DOMAIN).pot
@if [ ! -f $@ ]; then \
lang=`echo $@ | $(SED) -r -e 's/\.po$$//'` # Strip .po suffix ; \
echo Creating nonexistent $@, you should add this file to your SCM repository; \
$(MSGINIT) --locale $$lang --no-translator -i $(DOMAIN).pot -o $@; \
fi; \
$(MSGMERGE) $@ -o $@ $(DOMAIN).pot
create-po: $(DOMAIN).pot
@for po_file in $(po_files); do \
if [ ! -e $$po_file ]; then \
lang=`echo $$po_file | $(SED) -r -e 's/\.po$$//'` # Strip .po suffix ; \
echo Creating nonexistent $$po_file, you should add this file to your SCM repository; \
$(MSGINIT) --locale $$lang --no-translator -i $(DOMAIN).pot -o $$po_file; \
fi; \
done
update-po: update-pot
$(MAKE) all
update-pot:
@rm -f $(DOMAIN).pot.update
@$(XGETTEXT) $(XGETTEXT_OPTIONS) \
--output $(DOMAIN).pot.update \
--language="python" \
$(PYTHON_POTFILES) \
&& \
$(XGETTEXT) $(XGETTEXT_OPTIONS) \
--output $(DOMAIN).pot.update \
--join-existing \
--language="c" \
$(C_POTFILES) ; \
$(SED) '/^"POT-Creation-Date: .*"$$/d' $(DOMAIN).pot.update > $(DOMAIN).pot.update.tmp ; \
$(SED) -i -r -e 's%("Content-Type: text/plain; charset=)(.*)(\\n")%\1UTF-8\3%' $(DOMAIN).pot.update.tmp ; \
$(SED) '/^"POT-Creation-Date: .*"$$/d' $(DOMAIN).pot > $(DOMAIN).pot.tmp ; \
if ! cmp -s $(DOMAIN).pot.update.tmp $(DOMAIN).pot.tmp ; then \
echo "$(DOMAIN).pot updated" ; \
mv $(DOMAIN).pot.update $(DOMAIN).pot ; \
# Replace the charset with UTF-8 ; \
$(SED) -i -r -e 's%("Content-Type: text/plain; charset=)(.*)(\\n")%\1UTF-8\3%' $(DOMAIN).pot ; \
else \
echo "$(DOMAIN).pot unmodified" ; \
fi || :
@rm -f $(DOMAIN).pot.update $(DOMAIN).pot.update.tmp $(DOMAIN).pot.tmp
msg-stats:
@pot_count=`$(MSGFMT) --statistics $(DOMAIN).pot 2>&1 | \
$(AWK) '{match($$0, /([0-9]+) translated messages, ([0-9]+) untranslated messages/, groups); \
printf "%s\n", groups[2];}'` ; \
echo "$(DOMAIN).pot has $$pot_count messages. There are $(po_count) po translation files." ; \
for po_file in $(po_files); do \
$(MSGCMP) $$po_file $(DOMAIN).pot 2>&1 | \
$(AWK) -v po_file=$$po_file -v pot_count=$$pot_count -v pot_file=$(DOMAIN).pot \
'BEGIN {po_untranslated=0; undefined=0; \
po_name = gensub(/.po$$/, "", 1, po_file)} \
/this message is untranslated/ {po_untranslated++} \
/this message is used but not defined/ {undefined++} \
END {untranslated = po_untranslated+undefined; \
translated = pot_count - untranslated; \
ratio = sprintf("%d/%d", translated, pot_count); \
printf "%-7s %8s %5.1f%% %4d po untranslated, %4d missing, %4d untranslated\n", \
po_name ":", ratio, translated/pot_count*100.0, po_untranslated, undefined, untranslated;}'; \
done
mo-files: $(mo_files)
install: $(mo_files)
@for lang in $(languages); do \
dstdir=$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES; \
$(MKDIR_P) $$dstdir; \
$(INSTALL) $$lang.mo $$dstdir/$(DOMAIN).mo; \
done
mostlyclean:
rm -rf *.mo test.po test_locale
rm -f $(DOMAIN).pot.update $(DOMAIN).pot.update.tmp $(DOMAIN).pot.tmp
clean: mostlyclean
distclean: clean
rm -f Makefile
maintainer-clean: distclean
# We test our translations by taking the original untranslated string
# (e.g. msgid) and prepend a prefix character and then append a suffix
# character. The test consists of asserting that the first character in the
# translated string is the prefix, the last character in the translated string
# is the suffix and the everything between the first and last character exactly
# matches the original msgid.
#
# We use unicode characters not in the ascii character set for the prefix and
# suffix to enhance the test. To make reading the translated string easier the
# prefix is the unicode right pointing arrow and the suffix left pointing arrow,
# thus the translated string looks like the original string enclosed in
# arrows. In ASCII art the string "foo" would render as:
# -->foo<--
#
# Unicode right pointing arrow: u'\u2192', utf-8 = '\xe2\x86\x92'
# Unicode left pointing arrow: u'\u2190', utf-8 = '\xe2\x86\x90'
#
# The sed command below performs the prefix and suffix substitution.
#
# When msginit is invoked with an English target locale it copies the msgid
# into the msgstr. This is an undocumented feature of msginit. Otherwise the
# msgstr will be set to the empty string (i.e. untranslated). We depend on
# the msgid being copied to the msgstr.
test_lang:
rm -rf test.po test_locale
$(MSGINIT) --no-translator -i $(DOMAIN).pot -l en_US -o test.po
$(SED) -i -r -e 's/^msgstr[ \t]+"(.*)"[ \t]*$$/msgstr "\xe2\x86\x92\1\xe2\x86\x90"/' test.po
$(MKDIR_P) test_locale/en_US/LC_MESSAGES
$(MSGFMT) -o test_locale/en_US/LC_MESSAGES/ipa.mo test.po
test: test_lang
./test_i18n.py
maintainer-clean:

View File

@ -22,6 +22,9 @@ A: Edit the LINGUAS file and add the new language. Then run "make create-po".
yet. Be sure to add the new .po file(s) to the source code repository. For
certain languages, you may have to edit the Plurals line. See:
http://www.gnu.org/software/hello/manual/gettext/Plural-forms.html
However, if this line is wrong, it is often an indicator that the locale
value is incorrect. For example, using 'jp' for Japanese in stead of 'ja'
will result in an invailid Plural's line.
Q: What files must be under source code control?

View File

@ -1,4 +1,4 @@
# Language jp translations for ipa package.
# Hebrew translations for ipa package.
# Copyright (C) 2010 Red Hat
# This file is distributed under the same license as the ipa package.
# Automatically generated, 2010.
@ -6,16 +6,17 @@
msgid ""
msgstr ""
"Project-Id-Version: ipa\n"
"Report-Msgid-Bugs-To: https://hosted.fedoraproject.org/projects/freeipa/newticket\n"
"Report-Msgid-Bugs-To: https://hosted.fedoraproject.org/projects/freeipa/"
"newticket\n"
"POT-Creation-Date: 2010-09-27 10:25-0400\n"
"PO-Revision-Date: 2010-09-27 10:23-0400\n"
"PO-Revision-Date: 2010-09-27 10:25-0400\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: jp\n"
"Language: he\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: ../../ipalib/parameters.py:295
msgid "incorrect type"

View File

@ -1,4 +1,4 @@
# Language iw translations for ipa package.
# Japanese translations for ipa package.
# Copyright (C) 2010 Red Hat
# This file is distributed under the same license as the ipa package.
# Automatically generated, 2010.
@ -6,17 +6,17 @@
msgid ""
msgstr ""
"Project-Id-Version: ipa\n"
"Report-Msgid-Bugs-To: https://hosted.fedoraproject.org/projects/freeipa/newticket\n"
"Report-Msgid-Bugs-To: https://hosted.fedoraproject.org/projects/freeipa/"
"newticket\n"
"POT-Creation-Date: 2010-09-27 10:25-0400\n"
"PO-Revision-Date: 2010-09-27 10:23-0400\n"
"PO-Revision-Date: 2010-09-27 10:25-0400\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: iw\n"
"Language: ja\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../ipalib/parameters.py:295
msgid "incorrect type"
@ -235,7 +235,6 @@ msgstr ""
msgid "command %(name)r takes at most %(count)d argument"
msgid_plural "command %(name)r takes at most %(count)d arguments"
msgstr[0] ""
msgstr[1] ""
#: ../../ipalib/errors.py:674
#, python-format
@ -517,7 +516,6 @@ msgstr ""
msgid "%(count)d rolegroup matched"
msgid_plural "%(count)d rolegroups matched"
msgstr[0] ""
msgstr[1] ""
#: ../../ipalib/plugins/host.py:86
msgid "Fully-qualified hostname required"
@ -632,7 +630,6 @@ msgstr ""
msgid "%(count)d host matched"
msgid_plural "%(count)d hosts matched"
msgstr[0] ""
msgstr[1] ""
#: ../../ipalib/plugins/host.py:337 ../../ipalib/plugins/service.py:83
msgid "Keytab"
@ -695,7 +692,6 @@ msgstr ""
msgid "%(count)d group matched"
msgid_plural "%(count)d groups matched"
msgstr[0] ""
msgstr[1] ""
#: ../../ipalib/plugins/group.py:254
#, python-format
@ -831,7 +827,6 @@ msgstr ""
msgid "%(count)d service matched"
msgid_plural "%(count)d services matched"
msgstr[0] ""
msgstr[1] ""
#: ../../ipalib/plugins/service.py:396
msgid "Service principal has no kerberos key"
@ -1207,7 +1202,6 @@ msgstr ""
msgid "%(count)d ACI matched"
msgid_plural "%(count)d ACIs matched"
msgstr[0] ""
msgstr[1] ""
#: ../../ipalib/plugins/krbtpolicy.py:63
msgid "Manage ticket policy for specific user"
@ -1437,7 +1431,6 @@ msgstr ""
msgid "%(count)d plugin loaded"
msgid_plural "%(count)d plugins loaded"
msgstr[0] ""
msgstr[1] ""
#: ../../ipalib/plugins/misc.py:116
msgid "Number of plugins loaded"
@ -1535,7 +1528,6 @@ msgstr ""
msgid "%(count)d user matched"
msgid_plural "%(count)d users matched"
msgstr[0] ""
msgstr[1] ""
#: ../../ipalib/plugins/user.py:278
#, python-format
@ -1583,7 +1575,6 @@ msgstr ""
msgid "%(count)d taskgroup matched"
msgid_plural "%(count)d taskgroups matched"
msgstr[0] ""
msgstr[1] ""
#: ../../ipalib/plugins/hostgroup.py:74
msgid "Host-group"
@ -1625,7 +1616,6 @@ msgstr ""
msgid "%(count)d hostgroup matched"
msgid_plural "%(count)d hostgroups matched"
msgstr[0] ""
msgstr[1] ""
#: ../../ipalib/plugins/pwpolicy.py:84
#, python-format