]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - po/Makefile
Update copyright dates with scripts/update-copyrights
[thirdparty/glibc.git] / po / Makefile
index 28f0f5ba6d54f5bd20e5394e570e6e0b056ea8a5..b1ae8d655cf7f7e54b0ffb567a280e01779ef0c3 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 1996-2015 Free Software Foundation, Inc.
+# Copyright (C) 1996-2024 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
 
 # You should have received a copy of the GNU Lesser General Public
 # License along with the GNU C Library; if not, see
-# <http://www.gnu.org/licenses/>.
+# <https://www.gnu.org/licenses/>.
 
 # Makefile for installing libc message catalogs.
 
@@ -39,11 +39,13 @@ endif
 domainname = libc
 
 # Pattern for where message catalog object for language % gets installed.
-mo-installed = $(inst_msgcatdir)/%/LC_MESSAGES/$(domainname).mo
+mo-installed = $(inst_localedir)/%/LC_MESSAGES/$(domainname).mo
 
 # Files to install: a $(domainname).mo file for each language.
 install-others = $(LINGUAS:%=$(mo-installed))
 
+generated += $(ALL_LINGUAS:%=%.mo)
+
 
 include ../Rules
 
@@ -55,13 +57,13 @@ libc.pot: pot.header libc.pot.files
            -e "s/DATE/`date +'%Y-%m-%d %H:%M'$$disp`/" \
            -e "s/CHARSET/UTF-8/" \
            $< > $@.new
-       egrep -v '\.ksh$$' $(word 2,$^) > $(objdir)/tmp-libc.pot-files
+       grep -E -v '\.ksh$$' $(word 2,$^) > $(objdir)/tmp-libc.pot-files
        cd ..; $(XGETTEXT) --keyword=_ --keyword=N_ \
                           --add-comments=TRANS --flag=error:3:c-format \
                           --flag=f_print:2:c-format \
                           --sort-by-file --omit-header -E -n -d - \
                           -f $(objdir)/tmp-libc.pot-files >> po/$@.new
-       egrep '\.ksh$$' $(word 2,$^) > $(objdir)/tmp-libc.pot-files
+       grep -E '\.ksh$$' $(word 2,$^) > $(objdir)/tmp-libc.pot-files
        cd ..; $(XGETTEXT) --add-comments=TRANS --language=Shell \
                           --sort-by-file --omit-header -E -n -o po/$@.new -j \
                           -f $(objdir)/tmp-libc.pot-files po/$@.new
@@ -80,32 +82,24 @@ libc.pot.files: FORCE
 
 # Compile the binary message object files from the portable object source
 # files of translations for each language.
-%.mo: %.po
+$(objpfx)%.mo: %.po
+       $(make-target-directory)
        $(MSGFMT) -o $@ $<
 
 # Install the message object files as libc.po in the language directory.
-$(mo-installed): %.mo $(+force); $(do-install) || exit 0
-
-.PHONY: linguas linguas.mo
-linguas: $(ALL_LINGUAS:=.po)
-linguas.mo: $(ALL_LINGUAS:=.mo)
-
-realclean:
-       rm -f $(ALL_LINGUAS:=.mo)
+$(mo-installed): $(objpfx)%.mo $(+force); $(do-install) || exit 0
 \f
-# Copy the PO files from the translation coordinator's repository.
-
-podir = /com/share/ftp/gnu/po/maint/glibc
-
-pofiles := $(wildcard $(podir)/*.po)
-
-ifneq (,$(pofiles))
-
-%.po: $(podir)/%.po
-       cp -f $< $@
-       chmod 444 $@
-
-linguas: $(pofiles:$(podir)/%=%)
-linguas.mo: $(pofiles:$(podir)/%.po=%.mo)
-
-endif
+# Update translations from the translation project.
+TRANSLATIONS_URL = https://translationproject.org/latest/libc
+WGET = wget
+
+update-translations:
+       $(WGET) -qO- $(TRANSLATIONS_URL) | sed -n 's|.*href="\([^"]\+po\)".*|\1|p' | \
+         while read f; do \
+           $(WGET) -O $(objdir)/$$f-tmp2 $(TRANSLATIONS_URL)/$$f && \
+           msgmerge --previous --no-wrap $(objdir)/$$f-tmp2 libc.pot > \
+             $(objdir)/$$f-tmp && \
+           msgattrib --translated --no-fuzzy --no-obsolete --no-wrap \
+             $(objdir)/$$f-tmp > $(objdir)/$$f-tmp0 && \
+           mv -f $(objdir)/$$f-tmp0 $$f; \
+         done