From eb809c2ca74342a546307a653a8ae25176d018ce Mon Sep 17 00:00:00 2001 From: Florent Villard Date: Tue, 12 Aug 2003 05:57:01 +0000 Subject: add po files --- po/Makefile | 75 ++++++++++++++++++++++++++++++++ po/bootsplash.pot | 44 +++++++++++++++++++ po/fr.po | 24 +++++++++++ po/gprintify.py | 84 ++++++++++++++++++++++++++++++++++++ po/xgettext_sh.py | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 354 insertions(+) create mode 100644 po/Makefile create mode 100644 po/bootsplash.pot create mode 100644 po/fr.po create mode 100755 po/gprintify.py create mode 100755 po/xgettext_sh.py diff --git a/po/Makefile b/po/Makefile new file mode 100644 index 0000000..a62d582 --- /dev/null +++ b/po/Makefile @@ -0,0 +1,75 @@ +INSTALL= /usr/bin/install -c +INSTALL_PROGRAM= ${INSTALL} +INSTALL_DATA= ${INSTALL} -m 644 +INSTALLNLSDIR=/usr/share/locale + +MSGMERGE = msgmerge + +NLSPACKAGE = bootsplash + +CATALOGS = $(shell ls *.po) +FMTCATALOGS = $(patsubst %.po,%.mo,$(CATALOGS)) + +all: $(FMTCATALOGS) + +pot $(NLSPACKAGE).pot: + rm -rf tmp + mkdir tmp + cp ../scripts/splash.sh tmp + ./gprintify.py tmp/* + ./xgettext_sh.py tmp/* > $(NLSPACKAGE).po + if cmp -s $(NLSPACKAGE).po $(NLSPACKAGE).pot; then \ + rm -f $(NLSPACKAGE).po; \ + else \ + mv $(NLSPACKAGE).po $(NLSPACKAGE).pot; \ + fi + rm -rf tmp + +update-po: Makefile + $(MAKE) $(NLSPACKAGE).pot + catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + lang=`basename $$cat .po`; \ + if $(MSGMERGE) $$lang.po $(NLSPACKAGE).pot > $$lang.pot ; then \ + mv -f $$lang.pot $$lang.po ; \ + echo "$(MSGMERGE) of $$lang succeeded" ; \ + else \ + echo "$(MSGMERGE) of $$lang failed" ; \ + rm -f $$lang.pot ; \ + fi \ + done + +refresh-po: Makefile + catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + lang=`echo $$cat | sed 's/.po//'`; \ + if $(MSGMERGE) $$lang.po $(NLSPACKAGE).pot > $$lang.pot ; then \ + mv -f $$lang.pot $$lang.po ; \ + echo "$(MSGMERGE) of $$lang succeeded" ; \ + else \ + echo "$(MSGMERGE) of $$lang failed" ; \ + rm -f $$lang.pot ; \ + fi \ + done + +clean: + rm -f *mo *.pyc + +distclean: clean + rm -f .depend Makefile + +depend: + +install: all + mkdir -p $(PREFIX)/$(INSTALLNLSDIR) + for n in $(CATALOGS); do \ + l=`basename $$n .po`; \ + mo=$$l.mo; \ + $(INSTALL) -m 755 -d $(prefix)/$(INSTALLNLSDIR)/$$l; \ + $(INSTALL) -m 755 -d $(prefix)/$(INSTALLNLSDIR)/$$l/LC_MESSAGES; \ + $(INSTALL) -m 644 $$mo \ + $(prefix)/$(INSTALLNLSDIR)/$$l/LC_MESSAGES/$(NLSPACKAGE).mo; \ + done + +%.mo: %.po + sed 's/$[a-zA-Z0-9_{}]*/%s/g' < $< | msgfmt -o $@ - diff --git a/po/bootsplash.pot b/po/bootsplash.pot new file mode 100644 index 0000000..b424832 --- /dev/null +++ b/po/bootsplash.pot @@ -0,0 +1,44 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Free Software Foundation, Inc. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: initscripts VERSION\n" +"POT-Creation-Date: 2001-03-02 09:00+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#. all the letters that are a "yes" reply to yes/no questions +msgid "yY" +msgstr "" + +#. all the letters that are a "no" reply to yes/no questions +msgid "nN" +msgstr "" + +#. all the letters that are a "continue" reply to yes/no/continue questions +msgid "cC" +msgstr "" + +#: tmp/splash.sh:101 +msgid "Booting the system..." +msgstr "" + +#: tmp/splash.sh:98 +msgid "silent" +msgstr "" + +#: tmp/splash.sh:106 +msgid "Press F2 for verbose mode." +msgstr "" + +#: tmp/splash.sh:96 +msgid "Shutting down the system..." +msgstr "" + diff --git a/po/fr.po b/po/fr.po new file mode 100644 index 0000000..510f256 --- /dev/null +++ b/po/fr.po @@ -0,0 +1,24 @@ +#. all the letters that are a "yes" reply to yes/no questions +msgid "yY" +msgstr "yYoO" + +#. all the letters that are a "no" reply to yes/no questions +msgid "nN" +msgstr "nN" + +#. all the letters that are a "continue" reply to yes/no/continue questions +msgid "cC" +msgstr "cC" + +#: tmp/splash.sh:101 +msgid "Booting the system..." +msgstr "Démarrage du système..." + +#: tmp/splash.sh:106 +#, fuzzy +msgid "Press F2 for verbose mode." +msgstr "Appuyez sur F2 pour le mode détaillé" + +#: tmp/splash.sh:96 +msgid "Shutting down the system..." +msgstr "Arret du système..." diff --git a/po/gprintify.py b/po/gprintify.py new file mode 100755 index 0000000..b181249 --- /dev/null +++ b/po/gprintify.py @@ -0,0 +1,84 @@ +#!/usr/bin/python +#--------------------------------------------------------------- +# Project : Mandrake Linux +# Module : mandrake +# File : gprintify.py +# Version : $Id$ +# Author : Frederic Lepied +# Created On : Tue Feb 6 18:39:14 2001 +# Purpose : rewrite $"bla $TOTO bla" in "bla %s bla" $TOTO +# and echo => gprintf +# and toto=$"sfdg" => toto=`gprintf "sdfg"` +#--------------------------------------------------------------- + +import sys +import re + +echo_regex=re.compile('^(.*)echo +(-[en]+)?') +i18n_regex=re.compile('^(.*?)\$"([^"]+)"(.*)$') +var_regex=re.compile('(\$[a-zA-Z0-9_{}]+(?:\[\$[a-zA-Z0-9_{}]+\])?}?)') +assign_regex=re.compile('^([^\[=]+)=(\s*)$') + +def process_start(start): + res=echo_regex.findall(start) + if res: + if 'n' in res[0][1]: + return [res[0][0] + 'gprintf "', '"', ''] + else: + return [res[0][0] + 'gprintf "', '\\n"', ''] + else: + res=assign_regex.findall(start) + if res: + return [res[0][0] + '=' + '`gprintf "', '"', '`'] + else: + return [start + '"', '"', '', ''] + +def process_vars(str, trail): + var_res=var_regex.findall(str) + if var_res: + ret=var_regex.sub('%s', str) + trail + for v in var_res: + ret = ret + ' ' + v + return ret + else: + return str + trail + +def process_line(line): + res=i18n_regex.findall(line) + if res: + res=res[0] + start=process_start(res[0]) + str=process_vars(res[1], start[1]) + end=res[2] + final=start[0] + str + start[2] + + res=i18n_regex.findall(end) + if res: + res=res[0] + start=process_start(res[0]) + str=process_vars(res[1], start[1]) + end=res[2] + return final + start[0] + str + start[2] + end + '\n' + else: + return final + end + '\n' + else: + return line + +def process_file(filename): + fd=open(filename, 'r') + lines=fd.readlines() + fd.close() + + fd=open(filename, 'w') + for l in lines: + fd.write(process_line(l)) + fd.close() + +def main(args): + for f in args: + process_file(f) + +if __name__ == '__main__': + main(sys.argv[1:]) + +# gprintify.py ends here diff --git a/po/xgettext_sh.py b/po/xgettext_sh.py new file mode 100755 index 0000000..00a548a --- /dev/null +++ b/po/xgettext_sh.py @@ -0,0 +1,127 @@ +#!/usr/bin/python +# sh_xgettext +# Arnaldo Carvalho de Melo +# Wed Mar 10 10:24:35 EST 1999 +# Copyright Conectiva Consultoria e Desenvolvimento de Sistemas LTDA +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# Changelog +# Mon May 31 1999 Wanderlei Antonio Cavassin +# * option --initscripts + + +from sys import argv, stderr, exit +from string import find, split, strip + +s = {} + +def xgettext(arq, tokens_i18n): + line = 0 + f = open(arq, "r") + while 1: + l = f.readline() + if not l: break + line = line + 1 + if l[0:1] == '#': continue + elif l[0:1] == '\n': continue + else: + for token in tokens_i18n: + if not token[1]: + pos = find(l, token[0] + ' $"') + if pos == -1: + pos = find(l, token[0] + ' "') + else: + pos = find(l, token[0] + ' "') + if pos != -1: + text = split(l[pos:], '"')[1] + if not text: break + if len(text) <= 2 or find(text, '$') != -1: + continue + if text[-1] == '\\': + text = text[0:-1] + if s.has_key(text): + s[text].append((arq, line)) + else: + s[text] = [(arq, line)] + f.close() + +def print_header(): + print '# SOME DESCRIPTIVE TITLE.' + print '# Copyright (C) YEAR Free Software Foundation, Inc.' + print '# FIRST AUTHOR , YEAR.' + print '#' + print '#, fuzzy' + print 'msgid ""' + print 'msgstr ""' + print '"Project-Id-Version: initscripts VERSION\\n"' + print '"POT-Creation-Date: 2001-03-02 09:00+0100\\n"' + print '"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n"' + print '"Last-Translator: FULL NAME \\n"' + print '"Language-Team: LANGUAGE \\n"' + print '"MIME-Version: 1.0\\n"' + print '"Content-Type: text/plain; charset=CHARSET\\n"' + print '"Content-Transfer-Encoding: 8bit\\n"\n' + print '#. all the letters that are a "yes" reply to yes/no questions' + print 'msgid "yY"' + print 'msgstr ""' + print '' + print '#. all the letters that are a "no" reply to yes/no questions' + print 'msgid "nN"' + print 'msgstr ""' + print '' + print '#. all the letters that are a "continue" reply to yes/no/continue questions' + print 'msgid "cC"' + print 'msgstr ""' + print '' + +def print_pot(): + print_header() + + for text in s.keys(): + print '#:', + for p in s[text]: + print '%s:%d' % p, + if find(text, '%') != -1: + print '\n#, c-format', + print '\nmsgid "' + text + '"' + print 'msgstr ""\n' + +def main(): + i18n_tokens = [] + i18n_tokens.append(('echo', 0)) + i18n_tokens.append(('echo -n', 0)) + i18n_tokens.append(('echo -e', 0)) + i18n_tokens.append(('echo -en', 0)) + i18n_tokens.append(('echo -ne', 0)) + i18n_tokens.append(('action', 0)) + i18n_tokens.append(('failure', 0)) + i18n_tokens.append(('passed', 0)) + i18n_tokens.append(('runcmd', 0)) + i18n_tokens.append(('success', 0)) + i18n_tokens.append(('gprintf', 1)) + i18n_tokens.append(('/sbin/getkey -c $AUTOFSCK_TIMEOUT -m', 0)) + + for a in argv[1:]: +# xgettext(a, i18n_tokens) + try: + xgettext(a, i18n_tokens) + except: + stderr.write('error while processing "%s" \n' % a) + + print_pot() + +if __name__ == '__main__': + main() -- cgit v1.2.1