Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[r13118]: trunk / rosegarden / scripts / extract_instrument_tr_strings.pl Maximize Restore History

Download this file

extract_instrument_tr_strings.pl    113 lines (99 with data), 2.9 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/perl -w
use strict;
print qq{
/*
Rosegarden
A MIDI and audio sequencer and musical notation editor.
Copyright 2000-2009 the Rosegarden development team.
Other copyrights also apply to some parts of this work. Please
see the AUTHORS file and individual file headers for details.
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. See the file
COPYING included with this distribution for more information.
*/
/*
* This file has been automatically generated and should not be compiled.
*
* The purpose of the file is to collect the translation strings from the
* presets.xml file which are used to provide a sort of built-in
* encyclopedia of arranging to aid composers.
*
* The code is prepared for the lupdate program. There is make ts target:
*
* make ts
*
* which is used to extract translation strings and to update ts/*.tr files.
*/
};
my $file = $ARGV[0];
my $nextfile = $ARGV[1];
my $category_name = "";
my $instrument_name = "";
while (<>) {
if ($ARGV[0]) {
if ($nextfile ne $ARGV[0]) {
$file = $nextfile;
$nextfile = $ARGV[0];
}
}
my $line = $_;
if ($line =~ /category name="([^"]*)"/) {
$category_name = $1;
$instrument_name = "";
print 'QObject::tr("' . $category_name . '");';
print ' /* ' . $file;
print ' */
';
} elsif ($line =~ /instrument name="([^"]*)"/) {
$instrument_name = $1;
print 'QObject::tr("' . $instrument_name . '");';
print ' /* ' . $file;
print ' : ' . $category_name;
print ' */
';
}
}
# I will add these in this file, even though they are not related to the names
# in presets.xml. Let's get EVERY note name translated, and we'll separate the
# name from the octave component in strings like "C-2" so nobody has to
# translate the same damn thing again and again but for the number
print 'QObject::tr("Cb", "note name");
';
print 'QObject::tr("C", "note name");
';
print 'QObject::tr("C#", "note name");
';
print 'QObject::tr("Db", "note name");
';
print 'QObject::tr("D", "note name");
';
print 'QObject::tr("Eb", "note name");
';
print 'QObject::tr("E", "note name");
';
print 'QObject::tr("E#", "note name");
';
print 'QObject::tr("Fb", "note name");
';
print 'QObject::tr("F", "note name");
';
print 'QObject::tr("F#", "note name");
';
print 'QObject::tr("G", "note name");
';
print 'QObject::tr("G#", "note name");
';
print 'QObject::tr("Ab", "note name");
';
print 'QObject::tr("A#", "note name");
';
print 'QObject::tr("A", "note name");
';
print 'QObject::tr("Bb", "note name");
';
print 'QObject::tr("B", "note name");
';
print 'QObject::tr("B#", "note name");
';