From c3f2050c4aa8cd7f6dfefac368c228cbc415f2b1 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Mon, 8 Mar 2004 17:53:26 +0000 Subject: new files git-svn-id: file:///home/puszcza/svnroot/ellinika/trunk@29 941c8c0f-9102-463b-b60b-cd22ce0e6858 --- xtrans/LINGUA.html.xtrans | 490 ++++++++++++++++++++++++++++++++++++++++++++++ xtrans/Makefile.am | 1 + xtrans/i18n.inc | 48 +++++ 3 files changed, 539 insertions(+) create mode 100644 xtrans/LINGUA.html.xtrans create mode 100644 xtrans/Makefile.am create mode 100644 xtrans/i18n.inc diff --git a/xtrans/LINGUA.html.xtrans b/xtrans/LINGUA.html.xtrans new file mode 100644 index 0000000..2e88340 --- /dev/null +++ b/xtrans/LINGUA.html.xtrans @@ -0,0 +1,490 @@ +# -*- mode: indented-text -*- +# Copyright (C) 2004 Sergey Poznyakoff +# +# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +Import: copy +Import: string +Import: posix + +Include: i18n.inc + +Global: toc +[] + +Global: menu +{} + +Global: item_index +0 + +Global: row_index +0 + +Function: dict_encode_string word + str = "" + for i in range(len(word)): + if ord(word[i]) > 127: + str = str + "%" + hex(ord(word[i]))[2:] + else: + str = str + word[i] + return str + +Function: put_menu menu + i = 0 + xtrans.put(">> ") + for x in menu: + if i != 0: + xtrans.put("| ") + xtrans.put("""%s\n""" % + (x[1], x[2], x[0])) + i += 1 + + +Function: LangList title + def sorter(a,b,x=xtrans): + if x.gettext(a) > x.gettext(b): + return 1 + elif x.gettext(a) < x.gettext(b): + return -1 + else: + return 0 + + xtrans.put(""" + + +""") + langlist = copy.copy(xtrans.linguas) + langlist.sort(sorter) + xtrans.put(""" + + + +""") + i = 0 + for x in langlist: + xtrans.put(""" + +""" % (x, "index.html", x, xtrans.gettext(x))) ## FIXME! + xtrans.put(""" + + +
+ + %s + +
+ + +""") + +Function: PageTemplate title + hb = """ + + + + + + + + + +
+  [A GNU head]

+ + + [TOC] + + + + + + + +
%s
%s
%s
%s
%s
+ [ Valid HTML 4.01! ]
+

+

%s

+
+""" + xtrans.output.write(hb % + (xtrans.gettext("Γραμματική"), +# xtrans.gettext("Λεξικός πλούτος"), + xtrans.gettext("Λεξιλόγιο"), + xtrans.attr["LINGUA"]["LANG"], + xtrans.attr["LINGUA"]["TER"], + xtrans.gettext("Ελληνορωσικό λέξικο"), + xtrans.gettext("Πληροφορίες"), + xtrans.attr["AUTHOR"]["HOMEPAGE"], + xtrans.gettext("Αρχική σελίδα"), + title)) + + +Function: OpenPage title, prefix + xtrans.SetLocale(xtrans.attr["LINGUA"]["LANG"]) + xtrans.set_output(title, prefix) + if xtrans.content.has_key("AUTHOR") and xtrans.attr["AUTHOR"].has_key("EMAIL"): + xtrans.email = xtrans.attr["AUTHOR"]["EMAIL"] + else: + xtrans.email = "gray@gnu.org" + if xtrans.attr["LINGUA"].has_key("BASE"): + base = xtrans.attr["LINGUA"]["BASE"] + else: + base = posix.environ['BASE_HREF'] + hb = """ + + + + %s + + + + + + +""" + xtrans.output.write(hb % (title, + xtrans.email, + xtrans.generator, + xtrans.content["KEYWORDS"], + base)) + xtrans.PageTemplate(title) + + +Function: ClosePage + xtrans.output.write(""" +
+
+%s %s; + +
+ +""" + % ( + xtrans.gettext("Για προτάσεις ή απορίες σχετικά με αυτήν τη σελίδα επικοινωνήστε στο"), + xtrans.attr["AUTHOR"]["EMAIL"], + xtrans.attr["AUTHOR"]["CONTACT"])) + +Starttag: LINGUA + if xtrans.attr["LINGUA"].has_key("LANG"): + lang = xtrans.attr["LINGUA"]["LANG"] + "/" + else: + lang = "" + def namegen(xmlprefix, l, base, targetformat, pfx=lang): + return "%s%s.%s" % (pfx, base, targetformat) + xtrans.toc = [] + xtrans.attr["NAMEGEN"] = namegen + +Endtag: LINGUA + xtrans.i18n_cleanup + + +Starttag: MSGSTR + pass + +Endtag: MSGSTR + xtrans.msgid(xtrans.attr["MSGSTR"]["ID"], xtrans.content["MSGSTR"]) + +Starttag: TITLE nostrip + if xtrans.is_parent("TABULAR"): + xtrans.put('') + +Endtag: TITLE + if xtrans.is_parent("TABULAR"): + xtrans.put('') + +Starttag: PAGE + if xtrans.attr["PAGE"].has_key("PREFIX"): + prefix = xtrans.attr["PAGE"]["PREFIX"] + else: + prefix = "prefix" + xtrans.OpenPage(xtrans.attr["PAGE"]["TITLE"], prefix) + if xtrans.attr["PAGE"].has_key("MENU"): + menu = xtrans.menu[xtrans.attr["PAGE"]["MENU"]] + xtrans.put_menu(menu) + +Endtag: PAGE + xtrans.ClosePage() + + +Endtag: EMPH + xtrans.put('%s' % xtrans.content["EMPH"]) + +Endtag: CMD + xtrans.put('%s' % xtrans.content["CMD"]) + + +Endtag: PROG + xtrans.put('%s' % xtrans.content["PROG"]) + +Endtag: QUOTE + xtrans.put('%s' % xtrans.content["QUOTE"]) + +Function: canonical_name file + s = file[len(xtrans.targetdir):] + if s[0] == '/': + s = s[1:] + return s + + +Starttag: SEEALSO + xtrans.put("""""" % (xtrans.attr["SEEALSO"]["HREF"])) + +Endtag: SEEALSO + xtrans.put("") + +Function: TOCName string + xtrans.toc[-1][-1] = string + +Starttag: CHAPTER + toc = [1, + xtrans.output.name, + xtrans.attr["CHAPTER"]["NAME"], + xtrans.attr["CHAPTER"]["HREF"]] + xtrans.toc.append(toc) + xtrans.put("""

%s

""" + % (xtrans.attr["CHAPTER"]["HREF"], + xtrans.attr["CHAPTER"]["NAME"])) + +Starttag: SECTION + toc = [2, + xtrans.output.name, + xtrans.attr["SECTION"]["NAME"], + xtrans.attr["SECTION"]["HREF"]] + xtrans.toc.append(toc) + +Starttag: PARA nostrip + xtrans.put("\n

") + +Endtag: PARA + xtrans.put("

\n") + +Endtag: HEADER + if xtrans.is_parent("ITEMIZE"): + attr = xtrans.attr["ITEMIZE"] + n = 5 + xtrans.put("
") + elif xtrans.is_parent("SECTION"): + xtrans.TOCName(xtrans.content["HEADER"]) + attr = xtrans.attr["SECTION"] + n = 4 + elif xtrans.is_parent("CHAPTER"): + xtrans.TOCName(xtrans.content["HEADER"]) + attr = xtrans.attr["CHAPTER"] + n = 4 + xtrans.output.write("\n" % n) + if attr.has_key("HREF"): + xtrans.put("""""" % + (attr["HREF"], attr["NAME"])) + xtrans.put(xtrans.content["HEADER"]) + if attr.has_key("HREF"): + xtrans.put("") + xtrans.put("\n" % n) + if xtrans.is_parent("ITEMIZE"): + xtrans.put("
") + +Starttag: ITEMIZE + xtrans.put("
") + +Endtag: ITEMIZE + xtrans.put("
") + + +Function: item_split text + if xtrans.attr["TABULAR"].has_key("SPLIT"): + delim = xtrans.attr["TABULAR"]["SPLIT"] + str = "" + for s in text.split(delim): + if str == "" : + str = s + else: + str = str + " " + s + "" + return str; + return text + +Function: item_text + if xtrans.attr["TABULAR"].has_key("OR"): + delim = xtrans.attr["TABULAR"]["OR"] + str = "" + for s in xtrans.content["ITEM"].split(delim): + if str == "" : + str = xtrans.item_split(s) + else: + str = str + " " + delim + " " + xtrans.item_split(s) + return str; + else: + return xtrans.item_split(xtrans.content["ITEM"]) + +Function: restore_single_word text + if xtrans.attr["TABULAR"].has_key("SPLIT"): + delim = xtrans.attr["TABULAR"]["SPLIT"] + str = "" + for s in text.split(delim): + str = str + s + return str; + return text + +Function: restore_word + if xtrans.attr["TABULAR"].has_key("OR"): + delim = xtrans.attr["TABULAR"]["OR"] + return xtrans.restore_single_word(xtrans.content["ITEM"].split(delim)[0]) + else: + return xtrans.restore_single_word(xtrans.content["ITEM"]) + +Function: dict_reference word, reftext + xtrans.put('%s' + % (xtrans.attr["LINGUA"]["LANG"], + xtrans.attr["LINGUA"]["TER"], + xtrans.dict_encode_string(word), + reftext)) + +Endtag: ITEM + if xtrans.is_parent("ENUMERATE"): + xtrans.put('
  • %s
  • ' % (xtrans.content["ITEM"])) + elif xtrans.is_parent("ROW"): + xtrans.put(" ") + if xtrans.item_index == 0 and xtrans.attr["TABULAR"].has_key("ROWHEADING"): + xtrans.put('%s' % (xtrans.content["ITEM"])) + else: + if xtrans.row_index == 0 \ + and xtrans.attr["TABULAR"].has_key("DICTREF") \ + and xtrans.item_index >= int(xtrans.attr["TABULAR"]["DICTREF"]): + xtrans.dict_reference(xtrans.restore_word(), + xtrans.item_text()) + else: + xtrans.put(xtrans.item_text()) + xtrans.put(" ") + xtrans.item_index = xtrans.item_index + 1 + else: + xtrans.put('
    %s
    ' % (xtrans.content["ITEM"])) + +Endtag: FLECT + xtrans.put('-%s' % (xtrans.content["FLECT"])) + +Starttag: MENU + xtrans.menu[xtrans.attr["MENU"]["NAME"]] = [] + +Endtag: NODE + m = xtrans.menu[xtrans.attr["MENU"]["NAME"]] + if xtrans.attr["NODE"].has_key("HREF"): + href = xtrans.attr["NODE"]["HREF"] + else: + href = "" + if xtrans.attr["NODE"].has_key("NAME"): + name = xtrans.attr["NODE"]["NAME"] + else: + name = xtrans.content["NODE"] + m.append([xtrans.content["NODE"], name, href]) + + +Starttag: SUBPAGE + if xtrans.attr["SUBPAGE"].has_key("BAR"): + xtrans.put(""" + + +
    + + """) + xtrans.put(""" + + \n") + + + +Endtag: SUBPAGE + xtrans.put(""" + + +""") + +Starttag: ENUMERATE + xtrans.put(""" + +""") + +Endtag: BOLD + xtrans.put("""%s""" % (xtrans.content["BOLD"])) + + +Endtag: UBOLD + xtrans.put("""%s""" % (xtrans.content["UBOLD"])) + +Endtag: IT + xtrans.put('%s' % (xtrans.content["IT"])) + +Starttag: TABULAR + xtrans.put('\n") + +Endtag: TABULAR + xtrans.put("
    \n") + +Starttag: ROW + xtrans.item_index = 0 + xtrans.put("\n") + +Endtag: ROW + xtrans.row_index = xtrans.row_index + 1 + xtrans.put("\n") + + +Starttag: LOCALIZATION + pass + +Endtag: MSGSTR + xtrans.msgid(xtrans.attr["MSGSTR"]["ID"], xtrans.content["MSGSTR"]) + +Postmacro: TOC + if xtrans.attr["LINGUA"].has_key("TARGETDIR"): + pfx = xtrans.attr["LINGUA"]["TARGETDIR"] + "/" + else: + pfx = posix.environ['TARGET_DIR'] + "/" + filenum = len(xtrans.labels) + for i in range(filenum-1): + xtrans.put('%s\n' % + (pfx, + xtrans.filenames[i], + xtrans.labels[i])) + +Postmacro: TOC_DETAILED + for item in xtrans.toc: + xtrans.put("%s\n""" % + (item[3], item[3], item[2])) + + + diff --git a/xtrans/Makefile.am b/xtrans/Makefile.am new file mode 100644 index 0000000..e58c9f2 --- /dev/null +++ b/xtrans/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST=LINGUA.html.xtrans i18n.inc \ No newline at end of file diff --git a/xtrans/i18n.inc b/xtrans/i18n.inc new file mode 100644 index 0000000..15d0e27 --- /dev/null +++ b/xtrans/i18n.inc @@ -0,0 +1,48 @@ +# -*- mode: indented-text -*- +# This file is part of GNU RADIUS documentation. +# Copyright (C) 2000,2001,2002 Sergey Poznyakoff +# +# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +Global: linguas +[ 'en', 'fr', 'pl', 'es', 'el', 'ru' ] + + +Global: translations +{ } + +Function: msgid id, str + xtrans.translations[id] = str + +Function: SetLocale lang + xtrans.lang = lang + +Function: gettext messid + if not xtrans.translations.has_key(messid): + return messid + return xtrans.translations[messid] + +Global: charset_dict +{ 'def' : "iso-8859-1", 'pl': "iso-8859-2", 'ru': "koi8-r" } + +Function: charset lang + if not xtrans.charset_dict.has_key(lang): + lang = 'def' + return xtrans.charset_dict[lang] + +Function: i18n_cleanup + del(xtrans.translations) + xtrans.translations = {} + -- cgit v1.2.1