lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Patch] Fix #903: Add shortcuts for note names languages. (issue2606042)


From: v . villenave
Subject: [Patch] Fix #903: Add shortcuts for note names languages. (issue2606042)
Date: Wed, 20 Oct 2010 17:56:07 +0000

Reviewers: ,

Message:
Greetings everybody,

this user-friendly modification has been discussed for a while but
nothing concrete had been done so far.  Therefore I took the liberty of
proposing a very simple patch, since this modification is something I
really really need (well, not me, but rather the French music schools,
students etc. whom I introduce to LilyPond every other day).

Please review this patch on http://codereview.appspot.com/2606042 and
the issue on http://code.google.com/p/lilypond/issues/detail?id=903 --
the discussion has somehow gone South on this page, but I hope that my
patch is basic enough to make things simpler and more straigthforward
:-)

Cheers,
Valentin

Description:
Fix #903: Add shortcuts for note names languages.

This commit adds a new file, lang-init.ly, that
introduces new shortcut commands for notenames
language selection: instead of using \include "italiano.ly",
just use \langItaliano, and so on.

Standalone shortcuts have been defined for all available
languages.  A different syntax has been considered, such as

  \lang "italiano"

However, since the only way to pass arguments is currently
through a music-functions, and since you can't have toplevel
LilyPond definitions inside a music function, this would
require to modify either the parser (a rather heavy change)
either the italiano.ly&co files, which would break compatibility
with existing code.  The way I chose was the lightest, safest
and the most straightforward.

Full compatibility with the old syntax is preserved.  Once people
get used to the new syntax, we may consider a slightly different
implementation (or not).

Please review this at http://codereview.appspot.com/2606042/

Affected files:
  M ly/declarations-init.ly
  A ly/lang-init.ly


Index: ly/declarations-init.ly
diff --git a/ly/declarations-init.ly b/ly/declarations-init.ly
index 54aa7121e2ec6c1fe037da8ac4068b2a291ae86d..8e27d7a582abd8355449d55f67498a02ef137166 100644
--- a/ly/declarations-init.ly
+++ b/ly/declarations-init.ly
@@ -30,7 +30,8 @@ maxima = #(ly:make-duration -3 0)
 \include "toc-init.ly"

 %% default note names are dutch
-\include "nederlands.ly"
+\include "lang-init.ly"
+\langNederlands

 \include "drumpitch-init.ly"
 \include "chord-modifiers-init.ly"
Index: ly/lang-init.ly
diff --git a/ly/lang-init.ly b/ly/lang-init.ly
new file mode 100644
index 0000000000000000000000000000000000000000..ffbd68d4894e280673f9c3a1607d23aa312f3ecb
--- /dev/null
+++ b/ly/lang-init.ly
@@ -0,0 +1,69 @@
+%%%% This file is part of LilyPond, the GNU music typesetter.
+%%%%
+%%%% Copyright (C) 1996--2010 Han-Wen Nienhuys <address@hidden>
+%%%%                          Jan Nieuwenhuizen <address@hidden>
+%%%%
+%%%% LilyPond 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 3 of the License, or
+%%%% (at your option) any later version.
+%%%%
+%%%% LilyPond 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 LilyPond.  If not, see <http://www.gnu.org/licenses/>.
+
+\version "2.12.0"
+
+%
+% Add shortcuts for all available note name languages.
+%
+
+% The \langFoobar shortcut maintains compatibility with the old
+% \include "foobar.ly" syntax.  Long-term TODO plan: once the new
+% syntax is widely used, deprecate the old syntax, remove all
+% foobar.ly language files from the ly/ directory and regroup
+% all \pitchnamesFoobar alist definitions in this file.
+
+
+%% Default language.
+langNederlands =
+#(ly:parser-include-string parser "\\include \"nederlands.ly\"")
+
+%% This one adds more definitions than a typical language file.
+langArabic =
+#(ly:parser-include-string parser "\\include \"arabic.ly\"")
+
+
+langCatalan =
+#(ly:parser-include-string parser "\\include \"catalan.ly\"")
+
+langDeutsch =
+#(ly:parser-include-string parser "\\include \"deutsch.ly\"")
+
+langEnglish =
+#(ly:parser-include-string parser "\\include \"english.ly\"")
+
+langEspanol =
+#(ly:parser-include-string parser "\\include \"espanol.ly\"")
+
+langItaliano =
+#(ly:parser-include-string parser "\\include \"italiano.ly\"")
+
+langNorsk =
+#(ly:parser-include-string parser "\\include \"norsk.ly\"")
+
+langPortugues =
+#(ly:parser-include-string parser "\\include \"portugues.ly\"")
+
+langSuomi =
+#(ly:parser-include-string parser "\\include \"suomi.ly\"")
+
+langSvenska =
+#(ly:parser-include-string parser "\\include \"svenska.ly\"")
+
+langVlaams =
+#(ly:parser-include-string parser "\\include \"vlaams.ly\"")





reply via email to

[Prev in Thread] Current Thread [Next in Thread]