import glob
import re
-###### Translation data
-lang_lookup = {
- 'fr': 'français',
- 'es': 'español',
- '': 'english'
-}
-
-lang_other_langs = {
- 'es': 'Otros idiomas: ',
- 'fr': 'Autres langues : ',
- '': 'Other languages: '
-}
+###### Translation data, move out, see create-weblinks-itexi.py
+translations = {
+ 'de': {
+ 'English': 'Deutsch',
+ 'Other languages: ': 'Andere Sprachen: ',
+ },
+ 'es': {
+ 'English': 'Español',
+ 'Other languages: ': 'Otros idiomas: ',
+ },
+ 'fr': {
+ 'English': 'Français',
+ 'Other languages: ': 'Autres langues: ',
+ },
+ 'hu': {
+ 'English': 'Magyar',
+ 'Other languages: ': 'Más nyelvek: ',
+ },
+ 'ja': {
+ 'English': 'Japanese',
+ 'Other languages: ': '他の言語: ',
+ },
+ 'nl': {
+ 'English': 'Nederlands',
+ 'Other languages: ': 'Andere talen: ',
+ },
+ }
+
+# needs at least: make -C po or make- C Documentation/po
+HAVE_GETTEXT = False
+
+# Keep some freakin' gettext compatibility
+if HAVE_GETTEXT:
+ import lilylib as ly;
+ global _;_=ly._
+else: # poor mans translation
+ def _ (string, lang=os.environ['LANG']):
+ return translations.get (lang.split ('_')[0], {}).get (string, string)
+
exclude_manuals = [
'/music-glossary',
# it's a translation
lang = file_split[1]
# make sure it's a translated language
- if (not (lang == "en")):
+ if lang != "en":
langs_set.add(lang)
langs = list(langs_set)
langs.sort()
def makeFooter(filename, currentLang):
text = "<p id=\"languages\">\n"
- text += lang_other_langs[currentLang]
- for i in range(len(langs)):
- lang = langs[i]
+ text += _ ('Other languages: ', currentLang)
+ for lang in langs:
if (lang == currentLang):
continue
text += "<a href=\""
text += addLangExt(filename, lang, "html")
text += "\">"
- text += lang_lookup[lang]
- text += "</a>"
- if (i < len(langs)-2):
- text += ", "
- else:
- text += ".\n"
+ text += _ ('English', lang)
+ text += "</a>, "
+ text = text[:-2] + '.\n'
# TODO: add link to automatic language selection?
# still need to include this page in the new webpages somewhere
text += "</p>\n"
lang_footer = makeFooter(file_base, lang)
-
### alter file
for line in lines:
### alter links as appropriate