X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scripts%2Fbuild%2Fcreate-weblinks-itexi.py;h=e631c27fd8b43a5e7c75792be202237fadfb9d3d;hb=HEAD;hp=40df423e95ad8b47ddb78966c0798460bafc1b45;hpb=9158bc17904d4dd930a1f776cfe3226f1ad84092;p=lilypond.git diff --git a/scripts/build/create-weblinks-itexi.py b/scripts/build/create-weblinks-itexi.py index 40df423e95..e631c27fd8 100644 --- a/scripts/build/create-weblinks-itexi.py +++ b/scripts/build/create-weblinks-itexi.py @@ -1,6 +1,6 @@ #!@PYTHON@ # -*- coding: utf-8 -*- -# create-version-itexi.py +# create-weblinks-itexi.py """ when being called on lilypond.org, pass it the location of the top source dir on the command-line. """ @@ -9,17 +9,26 @@ import sys import os import glob -# these links are relative from /website/ on lilypond.org -depth = "../" - ### translation data -- shouldn't be here; see issue ### http://code.google.com/p/lilypond/issues/detail?id=1050 -langs = ['', 'de', 'es', 'fr', 'hu', 'it', 'ja', 'nl'] +import langdefs +# GUB only has python 2.4 !!! +# langs = [i.code if i.code != 'en' else '' for i in langdefs.WEB_LANGUAGES] +langs = [] +for lang in langdefs.WEB_LANGUAGES: + if lang.code == 'en': + langs.append('') + else: + langs.append(lang.code) + + +# these links are relative from /website/ on lilypond.org +depth = "../" # Get/update node translations ''' -for i in de es fr hu it ja nl; do +for i in ca cs de es fr hu it ja nl zh; do echo "'"$i"': {" (echo '--' ; grep -nH -B1 translationof Documentation/$i/web/* ) \ | pytt '^--\n.*@(?:unnum|sub)[^ ]* (.*)\n.*@translationof (.*)\n' "'\2': '\1',\n" \ @@ -29,6 +38,64 @@ done ''' translations = { + 'ca': { + 'Source': 'Font', + 'Learning': 'Aprenentatge', + 'Music glossary': 'Glossari musical', + 'Essay': 'Monografia', + 'Notation': 'Notació', + 'Usage': 'Ús', + 'Snippets': 'Fragments', + 'Web': 'Web', + 'Changes': 'Canvis', + + 'Extending': 'Extensions', + 'Internals': 'Funcionament intern', + 'Contributor': 'Guia del col·laborador', + + ' (split HTML)': ' (HTML seccionat)', + ' (big HTML)': ' (HTML monolític)', + + 'Regression tests for ': 'Proves de regressió per a ', + 'PDF of regtests for ': 'Proves de regressió en PDF per a ', + 'abc2ly Regression tests for ': 'Proves de regressió d\'abc2ly per a ', + 'PDF of abc2ly regtests for ': 'Proves de regressió d\'abc2ly en PDF per a ', + 'lilypond-book Regression tests for ': 'Proves de regressió de lilypond-book per a ', + 'PDF of lilypond-book regtests for ': 'Proves de regressió de lilypond-book en PDF per a ', + 'MusicXML Regression tests for ': 'Proves de regressió de MusicXML per a ', + 'PDF of MusicXML regtests for ': 'Proves de regressió de MusicXML en PDF per a ', + + 'Doc tarball for ': 'Tarball de la documentació per a ', + }, + 'cs': { + 'Source': 'Source', + 'Learning': 'Učení', + 'Music glossary': 'Slovníček', + 'Essay': 'Článek', + 'Notation': 'Notový zápis', + 'Usage': 'Používání', + 'Snippets': 'Úryvky', + 'Web': 'Web', + 'Changes': 'Změny', + + 'Extending': 'Rozšíření', + 'Internals': 'Vnitřnosti', + 'Contributor': 'Vývojářské', + + ' (split HTML)': ' (rozdělené HTML)', + ' (big HTML)': ' (velké HTML)', + + 'Regression tests for ': 'Zkoušky regresí ', + 'PDF of regtests for ': 'PDF zkoušky regresí ', + 'abc2ly Regression tests for ': 'abc2ly zkoušky regresí ', + 'PDF of abc2ly regtests for ': 'PDF abc2ly zkoušky regresí ', + 'lilypond-book Regression tests for ': 'lilypond-book zkoušky regresí ', + 'PDF of lilypond-book regtests for ': 'PDF lilypond-book zkoušky regresí ', + 'MusicXML Regression tests for ': 'MusicXML zkoušky regresí ', + 'PDF of MusicXML regtests for ': 'PDF MusicXML zkoušky regresí ', + + 'Doc tarball for ': 'Doc tarball for ', + }, 'de': { 'Source': 'Quellen', 'Learning': 'Einführung', @@ -49,11 +116,14 @@ translations = { 'Regression tests for ': 'Regressionstests für ', 'PDF of regtests for ': 'PDF der Regressionstests für ', + 'abc2ly Regression tests for ': 'abc2ly Regressionstests für ', + 'PDF of abc2ly regtests for ': 'PDF der abc2ly Regressionstests für ', + 'lilypond-book Regression tests for ': 'lilypond-book Regressionstests für ', + 'PDF of lilypond-book regtests for ': 'PDF der lilypond-book Regressionstests für ', 'MusicXML Regression tests for ': 'MusicXML Regressionstests für ', 'PDF of MusicXML regtests for ': 'PDF der MusicXML Regressionstests für ', 'Doc tarball for ': 'Dokumentation tar-gepackt für ', - ' (did not exist in 2.12)': ' (nicht existent in 2.12)', }, 'es': { 'Source': 'Código fuente', @@ -76,11 +146,14 @@ translations = { 'Regression tests for ': 'Pruebas de regresión para ', 'PDF of regtests for ': 'Pruebas en PDF para ', + 'abc2ly Regression tests for ': 'Pruebas de regresión de abc2ly para ', + 'PDF of abc2ly regtests for ': 'Pruebas de abc2ly en PDF para ', + 'lilypond-book Regression tests for ': 'Pruebas de regresión de lilypond-book para ', + 'PDF of lilypond-book regtests for ': 'Pruebas de lilypond-book en PDF para ', 'MusicXML Regression tests for ': 'Pruebas de regresión de MusicXML para ', 'PDF of MusicXML regtests for ': 'Pruebas de MusicXML en PDF para ', 'Doc tarball for ': 'Tarball de la documentación para ', - ' (did not exist in 2.12)': ' (no existía en la versión 2.12)', }, 'fr': { 'Source': 'Sources', @@ -103,11 +176,14 @@ translations = { 'Regression tests for ': 'Tests de régression pour ', 'PDF of regtests for ': 'PDF des tests de régression pour ', + 'abc2ly Regression tests for ': 'Tests de régression de abc2ly pour ', + 'PDF of abc2ly regtests for ': 'PDF des tests de régression de abc2ly pour ', + 'lilypond-book Regression tests for ': 'Tests de régression de lilypond-book pour ', + 'PDF of lilypond-book regtests for ': 'PDF des tests de régression de lilypond-book pour ', 'MusicXML Regression tests for ': 'Tests de régression de MusicXML pour ', 'PDF of MusicXML regtests for ': 'PDF des tests de régression de MusicXML pour ', 'Doc tarball for ': 'Archive de la documentation pour ', - ' (did not exist in 2.12)': ' (non disponible pour la version 2.12)', }, 'hu': { 'Source': 'Forrás', @@ -119,22 +195,52 @@ translations = { 'Snippets': 'Kódrészletek', 'Web': 'Web', 'Changes': 'Változások', - - #TODO - 'Extending': 0, + 'Extending': 'Bővítés', 'Internals': 'Belső működés', - 'Contributor': 0, + 'Contributor': 'Közreműködés', - ' (split HTML)': 0, - ' (big HTML)': 0, + ' (split HTML)': ' (HTML oldalak)', + ' (big HTML)': ' (egy nagy HTML oldal)', - 'Regression tests for ': 0, - 'PDF of regtests for ': 0, - 'MusicXML Regression tests for ': 0, - 'PDF of MusicXML regtests for ': 0, + 'Regression tests for ': 'Regressziós tesztek - verzió: ', + 'PDF of regtests for ': 'PDF formátumban - verzió: ', + 'abc2ly Regression tests for ': 'abc2ly regressziós tesztek - verzió: ', + 'PDF of abc2ly regtests for ': 'PDF formátumban - verzió: ', + 'lilypond-book Regression tests for ': 'lilypond-book regressziós tesztek - verzió: ', + 'PDF of lilypond-book regtests for ': 'PDF formátumban - verzió: ', + 'MusicXML Regression tests for ': 'MusicXML regressziós tesztek - verzió: ', + 'PDF of MusicXML regtests for ': 'PDF formátumban - verzió: ', - 'Doc tarball for ': 0, - ' (did not exist in 2.12)': 0, + 'Doc tarball for ': 'Tömörített csomag - verzió: ', + }, + 'it': { + 'Source': 'Sorgenti', + 'Learning': 'Apprendimento', + 'Music glossary': 'Glossario', + 'Essay': 'Saggio', + 'Notation': 'Notazione', + 'Usage': 'Uso', + 'Snippets': 'Frammenti', + 'Web': 'Web', + 'Changes': 'Cambiamenti', + 'Extending': 'Estendere', + 'Internals': 'Funzionamento interno', + 'Contributor': 'Guida del collaboratore', + +# keep the spaces! + ' (split HTML)': ' (HTML multipagina)', + ' (big HTML)': ' (HTML pagina unica)', + + 'Regression tests for ': 'Test di collaudo per ', + 'PDF of regtests for ': 'PDF dei test di collaudo per ', + 'abc2ly Regression tests for ': 'Test di collaudo di abc2ly per ', + 'PDF of abc2ly regtests for ': 'PDF dei test di collaudo di abc2ly per ', + 'lilypond-book Regression tests for ': 'Test di collaudo di lilypond-book per ', + 'PDF of lilypond-book regtests for ': 'PDF dei test di collaudo di lilypond-book per ', + 'MusicXML Regression tests for ': 'Test di collaudo di MusicXML per ', + 'PDF of MusicXML regtests for ': 'PDF dei test di collaudo di MusicXML per ', + + 'Doc tarball for ': 'Archivio della documentazione per ', }, 'ja': { 'Source': 'ソース', @@ -148,20 +254,24 @@ translations = { 'Changes': '変更点', #TODO - 'Extending': 0, + 'Extending': '拡張', 'Internals': '内部リファレンス', - 'Contributor': 0, + 'Contributor': '貢献者向けガイド', - ' (split HTML)': 0, - ' (big HTML)': 0, +# keep the spaces! + ' (split HTML)': ' (ページ毎に分割された HTML)', + ' (big HTML)': ' (1 つの大きな HTML)', - 'Regression tests for ': 0, - 'PDF of regtests for ': 0, - 'MusicXML Regression tests for ': 0, - 'PDF of MusicXML regtests for ': 0, + 'Regression tests for ': '回帰テスト バージョン ', + 'PDF of regtests for ': '回帰テスト (PDF 版) バージョン ', + 'abc2ly Regression tests for ': 'abc2ly 回帰テスト バージョン ', + 'PDF of abc2ly regtests for ': 'abc2ly 回帰テスト (PDF 版) バージョン ', + 'lilypond-book Regression tests for ': 'lilypond-book 回帰テスト バージョン ', + 'PDF of lilypond-book regtests for ': 'lilypond-book 回帰テスト (PDF 版) バージョン ', + 'MusicXML Regression tests for ': 'MusicXML 回帰テスト バージョン ', + 'PDF of MusicXML regtests for ': 'MusicXML 回帰テスト (PDF 版) バージョン ', - 'Doc tarball for ': 0, - ' (did not exist in 2.12)': 0, + 'Doc tarball for ': 'ドキュメント アーカイブ バージョン ', }, 'nl': { @@ -185,12 +295,45 @@ translations = { 'Regression tests for ': 'Regressietesten voor ', 'PDF of regtests for ': 'PDF van regressietesten voor ', + 'abc2ly Regression tests for ': 'abc2ly regressietesten voor ', + 'PDF of abc2ly regtests for ': 'abc2ly regressietesten voor ', + 'lilypond-book Regression tests for ': 'lilypond-book regressietesten voor ', + 'PDF of lilypond-book regtests for ': 'lilypond-book regressietesten voor ', 'MusicXML Regression tests for ': 'MusicXML regressietesten voor ', 'PDF of MusicXML regtests for ': 'MusicXML regressietesten voor ', 'Doc tarball for ': 'Tarball met documentation voor ', - ' (did not exist in 2.12)': ' (bestond nog niet in 2.12)', }, + 'zh': { + 'Source': '源码', + 'Learning': '学习', + 'Music glossary': '音乐术语表', + 'Essay': '文章', + 'Notation': '记谱法', + 'Usage': '使用', + 'Snippets': '片断', + 'Web': 'Web', + 'Changes': '变化', + + 'Extending': '扩展', + 'Internals': '内部机制', + 'Contributor': '贡献者', + +# keep the spaces! + ' (split HTML)': ' (分开的 HTML)', + ' (big HTML)': ' (大的 HTML)', + + 'Regression tests for ': '回归测试 ', + 'PDF of regtests for ': '回归测试的 PDF ', + 'abc2ly Regression tests for ': 'abc2ly 回归测试 ', + 'PDF of abc2ly regtests for ': 'abc2ly 的 PDF 回归测试 ', + 'lilypond-book Regression tests for ': 'lilypond-book 回归测试 ', + 'PDF of lilypond-book regtests for ': 'lilypond-book 的 PDF 回归测试 ', + 'MusicXML Regression tests for ': 'MusicXML 回归测试 ', + 'PDF of MusicXML regtests for ': 'MusicXML 的 PDF 回归测试 ', + + 'Doc tarball for ': '为文档压缩包', + }, } @@ -240,11 +383,13 @@ for line in version_contents: VERSION = str(major)+'.'+str(minor)+'.'+str(patch) def _ (string, lang): - return translations.get (lang.split ('_')[0], {}).get (string, string) + return translations.get (lang.split ('_')[0], {}).get (string, None) getTrans = _ # let's not barf, but print a warning when something's missing def getTrans(text, lang): + if not lang: + return text trans = _ (text, lang) if not trans: trans = text @@ -252,7 +397,7 @@ def getTrans(text, lang): return trans def macroLang(name, lang): - if (lang != ''): + if lang: return name + '-' + lang return name @@ -273,7 +418,9 @@ def make_download(name, osA, osB, version, revision, text): string += "}" make_macro(name, string) -def make_download_source(name, vstring, version, lang): +def make_download_source(name, version, lang): + assert "." in version + vstring = "v%s.%s" % tuple(version.split(".", 2)[0:2]) string = "@uref{http://download.linuxaudio.org/lilypond/sources/" string += vstring + "/" string += "lilypond-" + version + ".tar.gz" @@ -285,11 +432,11 @@ def make_download_source(name, vstring, version, lang): def make_all_downloads(macroName, version): make_download("download"+macroName+"LinuxNormal", "linux-x86/", - "linux-x86.sh", version, "1", "Linux x86") + "linux-x86.sh", version, "1", "GNU/Linux x86") make_download("download"+macroName+"LinuxBig", "linux-64/", - "linux-64.sh", version, "1", "Linux 64") + "linux-64.sh", version, "1", "GNU/Linux 64") make_download("download"+macroName+"LinuxPPC", "linux-ppc/", - "linux-ppc.sh", version, "1", "Linux PPC") + "linux-ppc.sh", version, "1", "GNU/Linux PPC") make_download("download"+macroName+"FreeBSDNormal", "freebsd-x86/", "freebsd-x86.sh", version, "1", "FreeBSD i386") @@ -319,30 +466,14 @@ def translateNameToUrl(manual, version): ver_minor = ver_split[0] + '.' + ver_split[1] url = depth + "doc/v" + ver_minor + "/Documentation/" - if (ver_minor == '2.13'): - return url+manual - if (ver_minor == '2.12'): - if (manual=='learning'): - return url+'user/lilypond-learning' - elif (manual=='internals'): - return url+'user/lilypond-internals' - elif (manual=='notation'): - return url+'user/lilypond' - elif (manual=='usage'): - return url+'user/lilypond-program' - elif (manual=='snippets'): - return url+'../input/lsr/lilypond-snippets' - elif (manual=='changes'): - return url+'topdocs/NEWS.html' - elif (manual=='music-glossary'): - return url+'user/music-glossary' - elif (manual=='essay'): - return url+'user/lilypond-learning/Background.html' - elif (manual=='extending'): - return url+'user/lilypond/Interfaces-for-programmers.html' - else: - return '' + return url+manual +def addLang(url, lang): + if lang: + base, ext = os.path.splitext(url) + return base + '.' + lang + ext + else: + return url def make_manual_links(name, version, lang): """Here is where all the macros manualStableLearningSplit, @@ -361,53 +492,35 @@ def make_manual_links(name, version, lang): manual = 'Music glossary' url = translateNameToUrl(m, version) - if (url == ''): - # can't have a comma here due to texinfo - make_ver_link(macroLang("manual"+name+mshort+'Pdf',lang), - "http://lilypond.org", - mshort+getTrans(" (did not exist in 2.12)",lang)) - make_ver_link(macroLang("manual"+name+mshort+'Split',lang), - "http://lilypond.org", - mshort+getTrans(" (did not exist in 2.12)",lang)) - make_ver_link(macroLang("manual"+name+mshort+'Big',lang), - "http://lilypond.org", - mshort+getTrans(" (did not exist in 2.12)",lang)) - make_ver_link(macroLang("manual"+name+mshort+'SplitNoName',lang), - "http://lilypond.org", - mshort+getTrans(" (did not exist in 2.12)",lang)) - continue - # this is stupid and I shouldn't have bothered trying - # to support the 2.12 docs and it will be deleted once - # 2.14 is out and the website won't be visible to users - # until 2.14 is out. -gp if (url.endswith('.html')): make_ver_link(macroLang("manual"+name+mshort+'Pdf',lang), - url, + addLang(url, lang), getTrans(manual.capitalize(),lang) + '.pdf') make_ver_link(macroLang("manual"+name+mshort+'Split',lang), - url, + addLang(url, lang), getTrans(manual.capitalize(),lang) + getTrans(' (split HTML)',lang)) make_ver_link(macroLang("manual"+name+mshort+'Big',lang), - url, + addLang(url, lang), getTrans(manual.capitalize(),lang) + getTrans(' (big HTML)',lang)) newurl = url else: make_ver_link(macroLang("manual"+name+mshort+'Pdf',lang), - url + '.pdf', + # TODO: this is an even stupider way of doing it + addLang(url+'.pdf', lang), getTrans(manual.capitalize(),lang) + '.pdf') make_ver_link(macroLang("manual"+name+mshort+'Split',lang), - url + '/index.html', + addLang(url + '/index.html', lang), getTrans(manual.capitalize(),lang) + getTrans(' (split HTML)',lang)) make_ver_link(macroLang("manual"+name+mshort+'Big',lang), - url + '-big-page.html', + addLang(url + '-big-page.html', lang), getTrans(manual.capitalize(),lang) + getTrans(' (big HTML)',lang)) newurl = url + '/index.html' make_ver_link(macroLang("manual"+name+mshort+'SplitNoName',lang), - newurl, + addLang(newurl, lang), getTrans(manual.capitalize(),lang)) def make_regtest_links(name, version, lang): @@ -431,47 +544,57 @@ def make_regtest_links(name, version, lang): url+"lilypond-book/collated-files.html", getTrans("lilypond-book Regression tests for ", lang)+version) make_ver_link(macroLang("regtest"+name+"XmlPdf", lang), - url+"musicxml/collated-files.html", + url+"musicxml/collated-files.pdf", getTrans("PDF of MusicXML regtests for ", lang)+version) make_ver_link(macroLang("regtest"+name+"AbcPdf", lang), - url+"abc2ly/collated-files.html", + url+"abc2ly/collated-files.pdf", getTrans("PDF of abc2ly regtests for ", lang)+version) make_ver_link(macroLang("regtest"+name+"LilypondBookPdf", lang), - url+"lilypond-book/collated-files.html", + url+"lilypond-book/collated-files.pdf", getTrans("PDF of lilypond-book regtests for ", lang)+version) def make_doctarball_links(name, version, lang): - url = depth + "download/binaries/documentation/lilypond-" + url = depth + "downloads/binaries/documentation/lilypond-" # ugly FIXME, but proper build number support isn't Critical. url += version + "-1" url += ".documentation.tar.bz2" make_ver_link(macroLang("doctarball"+name, lang), url, getTrans("Doc tarball for ", lang)+version) +print "@c This file was autogenerated" +print "@c from: %s" % VERSION +print "@c by: %s" % sys.argv[0] +print "" print "@c ************************ Download binaries ************" +print "" + make_all_downloads("Stable", VERSION_STABLE) make_all_downloads("Devel", VERSION_DEVEL) print "@c ************************ Download source ************" -# FIXME: icky hard-coding! -gp +print "" + for lang in langs: - print "@c *********", lang, "***" - make_download_source("downloadStableSource","v2.12",VERSION_STABLE,lang) - make_download_source("downloadDevelSource","v2.13",VERSION_DEVEL,lang) + print "@c *********", lang or "en", "***" + make_download_source("downloadStableSource", VERSION_STABLE, lang) + make_download_source("downloadDevelSource", VERSION_DEVEL, lang) print "@c ************************ Manual links ************" +print "" + for lang in langs: - print "@c *********", lang, "***" - make_manual_links("Stable", VERSION_STABLE,lang) - make_manual_links("Devel", VERSION_DEVEL,lang) + print "@c *********", lang or "en", "***" + make_manual_links("Stable", VERSION_STABLE, lang) + make_manual_links("Devel", VERSION_DEVEL, lang) - make_doctarball_links("Stable", VERSION_STABLE,lang) - make_doctarball_links("Devel", VERSION_DEVEL,lang) + make_doctarball_links("Stable", VERSION_STABLE, lang) + make_doctarball_links("Devel", VERSION_DEVEL, lang) print "@c ************************ Regtest links ************" -for lang in langs: - print "@c *********", lang, "***" - make_regtest_links("Stable", VERSION_STABLE,lang) - make_regtest_links("Devel", VERSION_DEVEL,lang) - +print "" +for lang in langs: + print "@c *********", lang or "en", "***" + make_regtest_links("Stable", VERSION_STABLE, lang) + make_regtest_links("Devel", VERSION_DEVEL, lang) +print "@c ***************************************************"