X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scripts%2Fbuild%2Fcreate-weblinks-itexi.py;h=97a53694a290597d3949d945eda8b03c40e97118;hb=98c7764605cb6b3b814295b17c0ae1959fcf9b07;hp=205214b71d89638b690be622a630071511f6f9a1;hpb=9e836c788ca801a60933c5da70fdce85d1daea7f;p=lilypond.git diff --git a/scripts/build/create-weblinks-itexi.py b/scripts/build/create-weblinks-itexi.py index 205214b71d..97a53694a2 100644 --- a/scripts/build/create-weblinks-itexi.py +++ b/scripts/build/create-weblinks-itexi.py @@ -15,13 +15,46 @@ depth = "../" ### translation data -- shouldn't be here; see issue ### http://code.google.com/p/lilypond/issues/detail?id=1050 -# don't add your language to this list unless you have all the -# items. -langs = ['', 'es'] +langs = ['', 'de', 'es', 'fr', 'hu', 'it', 'ja', 'nl'] + +# Get/update node translations +''' +for i in de es fr hu it ja nl; do + echo "'"$i"': {" + (echo '--' ; grep -nH -B1 translationof Documentation/$i/web/* ) \ + | pytt '^--\n.*@(?:unnum|sub)[^ ]* (.*)\n.*@translationof (.*)\n' "'\2': '\1',\n" \ + | grep -E 'Source|Learning|Glossary|Essay|Notation|Usage|Snippets|Web|Changes|Extending|Internals|Contributor' + echo "}," +done +''' -# FIXME: `grep -nH -B1 translationof Documentation//web/*' -# gives us the correct node names. translations = { + 'de': { + 'Source': 'Quellen', + 'Learning': 'Einführung', + 'Music glossary': 'Glossar', + 'Essay': 'Aufsatz', + 'Notation': 'Notation', + 'Usage': 'Benutzung', + 'Snippets': 'Schnipsel', + 'Web': 'Web', + 'Changes': 'Änderungen', + + 'Extending': 'Erweitern', + 'Internals': 'Interna', + 'Contributor': 'Beitragen', + + ' (split HTML)': ' (geteiltes HTML)', + ' (big HTML)': ' (großes HTML)', + + 'Regression tests for ': 'Regressionstests für ', + 'PDF of regtests for ': 'PDF der 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', @@ -50,9 +83,88 @@ translations = { ' (did not exist in 2.12)': ' (no existía en la versión 2.12)', }, 'fr': { - 'Learning': 'Apprener?', - 'Music glossary': 'Lizes ici pour les motes?', - }, + 'Source': 'Sources', + + 'Learning': 'Initiation', + 'Music glossary': 'Glossaire', + 'Essay': 'Essai', + 'Notation': 'Notation', + 'Usage': 'Utilisation', + 'Snippets': 'Morceaux choisis', + 'Web': 'Web', + 'Changes': 'Nouveautés', + 'Extending': 'Extension', + 'Internals': 'Propriétés internes', + 'Contributor': 'Guide du contributeur', + +# keep the spaces! + ' (split HTML)': ' (HTML multipages)', + ' (big HTML)': ' (HTML en page unique)', + + 'Regression tests for ': 'Tests de régression pour ', + 'PDF of regtests for ': 'PDF des tests de régression 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', + 'Learning': 'Tankönyv', + 'Music glossary': 'Fogalomtár', + 'Essay': 'Esszé', + 'Notation': 'Kottaírás', + 'Usage': 'Használat', + 'Snippets': 'Kódrészletek', + 'Web': 'Web', + 'Changes': 'Változások', + + #TODO + 'Extending': 'Bővítés', + 'Internals': 'Belső működés', + 'Contributor': 'Közreműködés', + + ' (split HTML)': ' (HTML oldalak)', + ' (big HTML)': ' (egy nagy HTML oldal)', + + 'Regression tests for ': 'Regressziós tesztek a következőhöz: ', + 'PDF of regtests for ': 'Regressziós tesztek PDF formátumban a következőhöz: ', + 'MusicXML Regression tests for ': 'MusicXML regressziós tesztek a következőhöz: ', + 'PDF of MusicXML regtests for ': 'MusicXML regressziós tesztek PDF formátumban a következőhöz: ', + + 'Doc tarball for ': 'Doc tarball a következőhöz: ', + ' (did not exist in 2.12)': ' (nem létezett a 2.12-es verzióban)', + }, + 'ja': { + 'Source': 'ソース', + 'Learning': '学習', + 'Music glossary': '用語集', + 'Essay': 'エッセー', + 'Notation': '記譜法', + 'Usage': '使用方法', + 'Snippets': 'コード断片集', + 'Web': 'Web', + 'Changes': '変更点', + + #TODO + 'Extending': '拡張', + 'Internals': '内部リファレンス', + 'Contributor': '貢献者向けガイド', + +# keep the spaces! + ' (split HTML)': ' (ページ毎に分割された HTML)', + ' (big HTML)': ' (1 つの大きな HTML)', + + 'Regression tests for ': '回帰テスト バージョン ', + 'PDF of regtests for ': '回帰テスト (PDF 版) バージョン ', + 'MusicXML Regression tests for ': 'MusicXML 回帰テスト バージョン ', + 'PDF of MusicXML regtests for ': 'MusicXML 回帰テスト (PDF 版) バージョン ', + + 'Doc tarball for ': 'ドキュメント アーカイブ バージョン ', + ' (did not exist in 2.12)': ' (バージョン 2.12 には存在しません)', + + }, 'nl': { 'Source': 'Broncode', @@ -80,7 +192,8 @@ translations = { 'Doc tarball for ': 'Tarball met documentation voor ', ' (did not exist in 2.12)': ' (bestond nog niet in 2.12)', }, -} + } + @@ -127,10 +240,17 @@ for line in version_contents: VERSION = str(major)+'.'+str(minor)+'.'+str(patch) +def _ (string, lang): + return translations.get (lang.split ('_')[0], {}).get (string, string) + +getTrans = _ +# let's not barf, but print a warning when something's missing def getTrans(text, lang): - if (lang != ''): - text = translations[lang][text] - return text + trans = _ (text, lang) + if not trans: + trans = text + sys.stderr.write ('create-weblinks-itexi: warning: [%(lang)s]: translation missing for: %(text)s\n' % locals ()) + return trans def macroLang(name, lang): if (lang != ''): @@ -224,8 +344,19 @@ def translateNameToUrl(manual, version): else: return '' +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, + manualStableLearningBig, manualStableLearningSplitNoName, etc. are + created on the fly. Hopefully this documentation string will help + others a bit while grepping for those. + """ for m in manuals: manual = m # TODO: this is a stupid way of doing it @@ -252,28 +383,40 @@ def make_manual_links(name, version, lang): "http://lilypond.org", mshort+getTrans(" (did not exist in 2.12)",lang)) continue - make_ver_link(macroLang("manual"+name+mshort+'Pdf',lang), - url + '.pdf', - getTrans(manual.capitalize(),lang) + '.pdf') - make_ver_link(macroLang("manual"+name+mshort+'Split',lang), - url + '/index.html', - getTrans(manual.capitalize(),lang) + - getTrans(' (split HTML)',lang)) - make_ver_link(macroLang("manual"+name+mshort+'Big',lang), - url + '-big-page.html', - getTrans(manual.capitalize(),lang) + - getTrans(' (big HTML)',lang)) # 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), + addLang(url, lang), + getTrans(manual.capitalize(),lang) + '.pdf') + make_ver_link(macroLang("manual"+name+mshort+'Split',lang), + addLang(url, lang), + getTrans(manual.capitalize(),lang) + + getTrans(' (split HTML)',lang)) + make_ver_link(macroLang("manual"+name+mshort+'Big',lang), + addLang(url, lang), + getTrans(manual.capitalize(),lang) + + getTrans(' (big HTML)',lang)) newurl = url else: + make_ver_link(macroLang("manual"+name+mshort+'Pdf',lang), + # 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), + addLang(url + '/index.html', lang), + getTrans(manual.capitalize(),lang) + + getTrans(' (split HTML)',lang)) + make_ver_link(macroLang("manual"+name+mshort+'Big',lang), + 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, - manual.capitalize()) + addLang(newurl, lang), + getTrans(manual.capitalize(),lang)) def make_regtest_links(name, version, lang): ver_split = version.split('.') @@ -289,9 +432,21 @@ def make_regtest_links(name, version, lang): make_ver_link(macroLang("regtest"+name+"Xml", lang), url+"musicxml/collated-files.html", getTrans("MusicXML Regression tests for ", lang)+version) + make_ver_link(macroLang("regtest"+name+"Abc", lang), + url+"abc2ly/collated-files.html", + getTrans("abc2ly Regression tests for ", lang)+version) + make_ver_link(macroLang("regtest"+name+"LilypondBook", 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.pdf", + getTrans("PDF of abc2ly regtests for ", lang)+version) + make_ver_link(macroLang("regtest"+name+"LilypondBookPdf", lang), + 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-"