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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
#!/usr/bin/perl
# Copyright (C) 2017 Mageia
#
# 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, or (at your option)
# any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# SYNOPSIS
#
# This program generates a PO file containing translations of the grub2
# runtime messages into the language specified by the first command line
# argument. grub2 must be installed on the build system, so that the
# translations are available.
#
# The full set of translations is quite large, so we only generate
# translations for the messages we expect to see in the ISO bootloader.
#
# The PO file (${LANGUAGE}-grub.po) is stored in the current working
# directory.
use lib qw(/usr/lib/libDrakX);
use strict;
use Cwd qw(abs_path getcwd);
use MDK::Common;
use common;
# Get correct namespace (grub instead of libDrakX).
BEGIN { unshift @::textdomains, 'grub' }
# Set the translation language.
@ARGV == 1 && $ARGV[0] or die "Usage: make-grub-po <language code>\n";
$ENV{LANGUAGE} = $ARGV[0];
# Define the list of strings we want to translate.
my @msgids = (
"Press enter to boot the selected OS, `e' to edit the commands before booting " .
"or `c' for a command-line. ESC to return previous menu.",
"The highlighted entry will be executed automatically in %ds.",
"%ds remaining.",
"%ds",
"Minimal BASH-like line editing is supported. For the first word, TAB lists " .
"possible command completions. Anywhere else TAB lists possible device or " .
"file completions. %s",
"ESC at any time exits.",
"Press any key to continue...",
"Possible commands are:",
"Possible devices are:",
"Possible files are:",
"Possible partitions are:",
"Possible arguments are:",
"Possible things are:",
"can't find command `%s'",
"one argument expected",
"two arguments expected",
"three arguments expected",
"four arguments expected",
"missing arguments",
"unknown argument",
"missing `%c' symbol",
"filename expected",
"file or layout name required",
"file `%s' not found",
"no terminal specified",
"terminal `%s' isn't found",
"Active input terminals:",
"Available input terminals:",
"Active output terminals:",
"Available output terminals:",
"no server is specified",
"Device %s:",
"Partition %s:",
"No known filesystem detected",
"Filesystem cannot be accessed",
"Filesystem type %s",
"- Label `%s'",
"- Last modification time %d-%02d-%02d %02d:%02d:%02d %s",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday",
" - Sector size %uB",
" - Total size %llu%sKiB",
" - Total size unknown",
"Loaded fonts:",
"error: %s.\n",
".5"
);
# Open the output file
my $fn = getcwd() . '/' . $ARGV[0] . '-grub.po';
open(my $fh, '>' . $fn) or die "couldn't open $fn";
print $fh "# This file is automatically generated\n";
print $fh "\n";
foreach (@msgids) {
my ($msgid) = $_;
my $msgstr = translate($msgid);
# Blank the message string if there is no translation available.
$msgstr = '' if $msgstr eq $msgid;
# Any double quote characters need to be escaped when writing the
# PO file.
$msgid =~ s/"/\\"/g;
$msgstr =~ s/"/\\"/g;
# Any newline characters need to be escaped when writing the
# PO file.
$msgid =~ s/\R/\\n/g;
$msgstr =~ s/\R/\\n/g;
# Write the entry for this item.
print $fh "msgid \"$msgid\"\n";
print $fh "msgstr \"$msgstr\"\n";
print $fh "\n";
}
close($fh);
|