Build resource file.

Generate expected_locale_keys from cmakefile
This commit is contained in:
Twan van Laarhoven
2020-04-10 14:23:54 +02:00
parent 6e7a4485a8
commit 4ebf0c51ee
4 changed files with 228 additions and 664 deletions
+10
View File
@@ -29,6 +29,16 @@ file(GLOB_RECURSE sources src/*.cpp)
target_sources(magicseteditor PRIVATE ${sources}) target_sources(magicseteditor PRIVATE ${sources})
target_precompile_headers(magicseteditor PRIVATE src/util/prec.hpp) target_precompile_headers(magicseteditor PRIVATE src/util/prec.hpp)
set(locale_keys_file "${PROJECT_SOURCE_DIR}/resource/expected_locale_keys")
add_custom_command(
COMMAND perl "${PROJECT_SOURCE_DIR}/tools/locale/locale.pl" "${PROJECT_SOURCE_DIR}/src" ${locale_keys_file}
OUTPUT ${locale_keys_file}
DEPENDS ${sources}
)
add_custom_target(generate_expected_locale_keys DEPENDS ${locale_keys_file})
add_dependencies(magicseteditor generate_expected_locale_keys)
target_sources(magicseteditor PRIVATE resource/win32_res.rc)
# warnings # warnings
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
# Update if necessary # Update if necessary
-628
View File
@@ -1,628 +0,0 @@
# This file contains the keys expected to be in MSE locales
# It was automatically generated by tools/locale/locale.pl
# Generated on Sat Jan 22 22:36:45 2011
action:
add control point: 0
add item: 1
add symmetry: 0
auto replace: 0
backspace: 0
change: 1
change combine mode: 0
change shape name: 0
change symmetry copies: 0
change symmetry type: 0
convert to curve: 0
convert to line: 0
correct: 0
cut: 0
delete: 0
delete point: 0
delete points: 0
duplicate: 1
enter: 0
group parts: 0
insert symbol: 0
lock point: 0
move: 1
move curve: 0
move handle: 0
move symmetry center: 0
move symmetry handle: 0
paste: 0
remove item: 1
reorder parts: 0
rotate: 1
scale: 1
shear: 1
soft line break: 0
typing: 0
ungroup parts: 0
button:
add custom pack: 0
add item: 0
always: 0
browse: 0
check now: 0
check updates: 0
close: 0
defaults: 0
don't install package: 0
edit symbol: 0
enabled: 0
evaluate: 0
export custom cards selection: 0
export entire set: 0
export generated packs: 0
fixed seed: 0
generate pack: 0
hide: 0
high quality: 0
if internet connection exists: 0
insert parameter: 0
install group: optional, 0
install package: 0
keep old: 0
keep package: 0
last opened set: 0
move down: 0
move up: 0
never: 0
new set: 0
number: 0
number overwrite: 0
open set: 0
open sets in new window: 0
overwrite: 0
random seed: 0
refer parameter: 0
reinstall package: 0
remove group: optional, 0
remove item: 0
remove package: 0
select: optional, 0
select all: 0
select cards: 0
select none: 0
show: 0
show editing hints: 0
show lines: 0
spellcheck enabled: 0
symbol gallery: optional, 0
upgrade group: optional, 0
upgrade package: 0
use auto replace: 0
use custom styling options: 0
use for all cards: 0
whole word: 0
zoom export: 0
error:
aborting parsing: 0
can't convert: 2
can't convert value: 3
can't download installer: 2
cannot create file: 1
change packages successful: 1
checking updates failed: 0
coordinates for blending overlap: 0
dependency not given: 4
dimension not found: 1
downloading updates: 0
expected key: 1
file not found: 2
file not found package like: 2
file parse error: 2
has no member: 2
has no member value: 2
images used for blending must have the same size: 0
in function: 2
in keyword reminder: 2
in parameter: 2
install packages successful: 1
installing updates: 0
newer version: 2
no game specified: 1
no stylesheet specified for the set: 0
no updates: 0
pack type duplicate name: 1
pack type not found: 1
package not found: 1
package out of date: 3
package too new: 4
remove packages: 1
remove packages modified: 2
remove packages successful: 1
stylesheet and set refer to different game: 0
successful install: optional, 2
unable to open output file: 0
unable to store file: 0
unrecognized value: 2
unsupported field type: 1
unsupported fill type: 1
unsupported format: 1
word list type not found: 1
help:
about: 0
add card: 0
add cards: 0
add keyword: 0
add symmetry: 0
add to dictionary: optional, 0
app language: 0
auto replace: 0
bar: 0
basic shapes: 0
bold: 0
border: 0
card list columns: 0
cards tab: 0
check updates: 0
click to select shape: 0
close symbol editor: 0
collapse notes: 0
console tab: 0
copies: 0
copy: 0
copy card: 0
copy keyword: 0
curve segment: 0
cut: 0
cut card: 0
cut keyword: 0
difference: 0
drag to draw shape: 0
drag to move curve: 0
drag to move line: 0
drag to move point: 0
drag to resize: 1
drag to rotate: 1
drag to shear: 1
draw ellipse: 0
draw polygon: 0
draw rectangle: 0
draw star: 0
duplicate: 0
edit pack type: 0
ellipse: 0
exit: 0
expand notes: 0
export: 0
export apprentice: 0
export html: 0
export image: 0
export images: 0
export mws: 0
filename format: 0
find: 0
find next: 0
fixed seed: 0
free point: 0
grid: 0
group: 0
index: 0
intersect: 0
italic: 0
keywords tab: 0
last opened set: 1
line segment: 0
merge: 0
new set: 0
new symbol: 0
new window: 0
next card: 0
next keyword: 0
no spelling suggestions: 0
number of packs: 1
open set: 0
open symbol: 0
orientation: 0
overlap: 0
paint: 0
paste: 0
paste card: 0
paste keyword: 0
pie: 0
points: 0
polygon: 0
preferences: 0
previous card: 0
previous keyword: 0
print: 0
print preview: 0
random pack tab: 0
random seed: 0
rectangle: 0
redo: 0
reflection: 0
reload data: 0
reminder text: 0
remove card: 0
remove keyword: 0
remove symmetry: 0
replace: 0
rotate: 0
rotate 0: 0
rotate 180: 0
rotate 270: 0
rotate 90: 0
rotate card: 0
rotation: 0
save set: 0
save set as: 0
save symbol: 0
save symbol as: 0
scatter: 0
scatter pie: 0
seed: 0
select: 0
set code: 0
set info tab: 0
show profiler: 0
sides: 0
smooth point: 0
snap: 0
stack: 0
star: 0
stats tab: 0
store symbol: 0
style tab: 0
subtract: 0
symbols: 0
symmetric point: 0
symmetry: 0
undo: 0
ungroup: 0
website: 0
welcome: 0
zoom export: 0
label:
app language: 0
apprentice: 0
apprentice exe: 0
apprentice export cancelled: 0
auto match: 0
auto replace: 0
card display: 0
card notes: 0
check at startup: 0
checking requires internet: 0
columns: 0
custom size: 0
export filenames: 0
external programs: 0
filename conflicts: 0
filename format: 0
filename is ignored: 0
filter: 0
fix aspect ratio: 0
force to fit: 0
game type: 0
html export options: 0
html template: 0
install package: 0
installable version: 0
installed version: 0
installer size: optional, 0
installer status: optional, 0
keyword: 0
language: 0
magic set editor package: optional, 0
match: 0
mode: 0
no version: 0
original: 0
original size: 0
pack name: 0
pack selection: 0
pack totals: 0
package action: 0
package conflicts: 0
package installable: 0
package installed: 0
package modified: 0
package name: 0
package status: 0
package updates: 0
percent of normal: 0
reinstall package: 0
reminder: 0
remove package: 0
result: 0
rules: 0
save changes: 1
search cards: 0
search keywords: 0
seed: 0
select cards: 0
select cards print: optional, 0
select columns: 0
selected card count: 1
selection: 0
selection height: 0
selection left: 0
selection top: 0
selection width: 0
set code: 0
sharpen filter: 0
sides: optional, 0
size: 0
size to fit: 0
standard keyword: 1
style type: 0
stylesheet not found: 1
styling options: 0
total cards: 0
upgrade package: 0
uses: 0
windows: 0
zoom: 0
zoom %: 0
zoom amount: 0
zoom amount x: 0
zoom amount y: 0
menu:
about: 0
add card: 0
add cards: 0
add keyword: 0
add to dictionary: optional, 0
auto replace: 0
bar: 0
basic shapes: 0
bold: 0
card list columns: 0
cards: 0
cards tab: 0
check updates: 0
close symbol editor: 0
console tab: 0
copy: 0
cut: 0
duplicate: 0
edit: 0
exit: 0
export: 0
export apprentice: 0
export html: 0
export image: 0
export images: 0
export mws: 0
file: 0
find: 0
find next: 0
format: 0
graph: 0
group: 0
help: 0
index: 0
insert symbol: 0
italic: 0
keywords: 0
keywords tab: 0
new set: 0
new symbol: 0
new window: 0
next card: 0
next keyword: 0
no spelling suggestions: 0
open set: 0
open symbol: 0
orientation: 0
paint: 0
paste: 0
pie: 0
points: 0
preferences: 0
previous card: 0
previous keyword: 0
print: 0
print preview: 0
random pack tab: 0
redo: 1
reload data: 0
reminder text: 0
remove card: 0
remove keyword: 0
replace: 0
rotate: 0
rotate 0: 0
rotate 180: 0
rotate 270: 0
rotate 90: 0
save set: 0
save set as: 0
save symbol: 0
save symbol as: 0
scatter: 0
scatter pie: 0
select: 0
set info tab: 0
show profiler: 0
stack: 0
stats tab: 0
store symbol: 0
style tab: 0
symbols: 0
symmetry: 0
tool: 0
undo: 1
ungroup: 0
website: 0
window: 0
title:
%s - magic set editor: 1
about: 0
auto replaces: 0
cannot create file: 0
custom pack: 0
directories: 0
display: 0
export cancelled: 0
export html: 0
export images: 0
global: 0
installing updates: 0
locate apprentice: 0
magic set editor: 0
new set: 0
open set: 0
packages window: 0
preferences: 0
print preview: 0
save changes: 0
save html: 0
save image: 0
save set: 0
select cards: 0
select cards export: 0
select columns: 0
select stylesheet: 0
slice image: 0
symbol editor: 0
untitled: 0
update check: 0
updates: 0
updates available: 0
tool:
add symmetry: 0
basic shapes: 0
border: 0
cards tab: 0
console tab: 0
curve segment: 0
difference: 0
ellipse: 0
free point: 0
grid: 0
intersect: 0
keywords tab: 0
line segment: 0
merge: 0
overlap: 0
paint: optional, 0
points: 0
polygon: 0
random pack tab: 0
rectangle: 0
redo: 0
reflection: 0
remove symmetry: 0
rotate: 0
rotation: 0
select: 0
set info tab: 0
smooth point: 0
snap: 0
star: 0
stats tab: 0
store symbol: 0
style tab: 0
subtract: 0
symmetric point: 0
symmetry: 0
undo: 0
tooltip:
add card: 0
add keyword: 0
add symmetry: 0
bar: 0
basic shapes: 0
bold: 0
border: 0
cards tab: 0
console tab: 0
copy: 0
curve segment: 0
cut: 0
difference: 0
ellipse: 0
export: 0
free point: 0
grid: 0
intersect: 0
italic: 0
keywords tab: 0
line segment: 0
merge: 0
new set: 0
open set: 0
overlap: 0
paint: optional, 0
paste: 0
pie: 0
points: 0
polygon: 0
random pack tab: 0
rectangle: 0
redo: 1
reflection: 0
reminder text: 0
remove card: 0
remove keyword: 0
remove symmetry: 0
rotate: 0
rotate card: 0
rotation: 0
save set: 0
scatter: 0
scatter pie: 0
select: 0
set info tab: 0
smooth point: 0
snap: 0
stack: 0
star: 0
stats tab: 0
store symbol: 0
style tab: 0
subtract: 0
symbols: 0
symmetric point: 0
symmetry: 0
undo: 1
type:
boolean: 0
card: 0
cards: 0
circle: 0
collection: 0
collection of: 1
color: 0
date: 0
double: 0
ellipse: 0
export template: 0
field: 0
function: 0
game: 0
group: 0
hexagon: 0
image: 0
integer: 0
keyword: 0
keywords: 0
locale: optional, 0
nil: 0
object: 0
pack: 0
package: optional, 0
pentagon: 0
point: 0
points: 0
polygon: 0
rectangle: 0
reflection: 0
rhombus: 0
rotation: 0
set: 0
shape: 0
shapes: 0
square: 0
star: 0
string: 0
style: 0
stylesheet: 0
symbol: 0
triangle: 0
value: 0
+191 -11
View File
@@ -8,10 +8,191 @@
// -------------------------------------------------------- : Icons // -------------------------------------------------------- : Icons
icon/app ICON "icon/app.ico" // has to come first in alphabet!! icon/app ICON "icon/app.ico" // has to come first in alphabet!!
icon/installer ICON "icon/installer.ico" icon/installer ICON "icon/installer.ico"
icon/set ICON "icon/set.ico" icon/set ICON "icon/set.ico"
icon/symbol ICON "icon/symbol.ico" icon/symbol ICON "icon/symbol.ico"
// -------------------------------------------------------- : Toolbar
cursor/rot_text CURSOR "cursor/rot_text.cur"
tool/new IMAGE "tool/new.png"
tool/open IMAGE "tool/open.png"
tool/save IMAGE "tool/save.png"
tool/export IMAGE "tool/export.png"
tool/export_html IMAGE "tool/export_html.png"
tool/export_image IMAGE "tool/export_image.png"
tool/export_images IMAGE "tool/export_images.png"
tool/export_mws IMAGE "tool/export_mws.png"
tool/export_apprentice IMAGE "tool/export_apprentice.png"
tool/print IMAGE "tool/print.png"
tool/print_preview IMAGE "tool/print_preview.png"
tool/undu IMAGE "tool/undo.png"
tool/redo IMAGE "tool/redo.png"
tool/cut IMAGE "tool/cut.png"
tool/copy IMAGE "tool/copy.png"
tool/paste IMAGE "tool/paste.png"
tool/find IMAGE "tool/find.png"
tool/bold IMAGE "tool/bold.png"
tool/italic IMAGE "tool/italic.png"
tool/symbol IMAGE "tool/symbol.png"
tool/reminder IMAGE "tool/reminder.png"
tool/no_auto IMAGE "tool/no_auto.png"
tool/card_add IMAGE "tool/card_add.png"
tool/card_add_multiple IMAGE "tool/card_add_multiple.png"
tool/card_del IMAGE "tool/card_del.png"
tool/card_rotate IMAGE "tool/card_rotate.png"
tool/card_rotate_0 IMAGE "tool/card_rotate_0.png"
tool/card_rotate_90 IMAGE "tool/card_rotate_90.png"
tool/card_rotate_180 IMAGE "tool/card_rotate_180.png"
tool/card_rotate_270 IMAGE "tool/card_rotate_270.png"
tool/keyword_add IMAGE "tool/keyword_add.png"
tool/keyword_del IMAGE "tool/keyword_del.png"
tool/graph_pie IMAGE "tool/graph_pie.png"
tool/graph_bar IMAGE "tool/graph_bar.png"
tool/graph_stack IMAGE "tool/graph_stack.png"
tool/graph_scatter IMAGE "tool/graph_scatter.png"
tool/graph_scatter_pie IMAGE "tool/graph_scatter_pie.png"
tool/window_cards IMAGE "tool/window_cards.png"
tool/window_set_info IMAGE "tool/window_set_info.png"
tool/window_style IMAGE "tool/window_style.png"
tool/window_keywords IMAGE "tool/window_keywords.png"
tool/window_statistics IMAGE "tool/window_statistics.png"
tool/window_random_pack IMAGE "tool/window_random_pack.png"
tool/window_console IMAGE "tool/window_console.png"
tool/help IMAGE "tool/help.png"
// -------------------------------------------------------- : Symbol editor
cursor/point CURSOR "cursor/point.cur"
cursor/point_add CURSOR "cursor/point_add.cur"
cursor/point_move CURSOR "cursor/point_move.cur"
cursor/curve CURSOR "cursor/curve.cur"
cursor/rotate CURSOR "cursor/rotate.cur"
cursor/shear_x CURSOR "cursor/shear_x.cur"
cursor/shear_y CURSOR "cursor/shear_y.cur"
tool/line IMAGE "tool/line.png"
tool/curve IMAGE "tool/curve.png"
tool/lock_free IMAGE "tool/lock_free.png"
tool/lock_dir IMAGE "tool/lock_dir.png"
tool/lock_size IMAGE "tool/lock_size.png"
tool/circle IMAGE "tool/circle.png"
tool/rectangle IMAGE "tool/rectangle.png"
tool/triangle IMAGE "tool/triangle.png"
tool/star IMAGE "tool/star.png"
tool/mode_select IMAGE "tool/mode_select.png"
tool/mode_rotate IMAGE "tool/mode_rotate.png"
tool/mode_curve IMAGE "tool/mode_curve.png"
tool/mode_paint IMAGE "tool/mode_paint.png"
tool/mode_symmetry IMAGE "tool/mode_symmetry.png"
tool/apply IMAGE "tool/apply.png"
tool/duplicate IMAGE "tool/duplicate.png"
tool/grid IMAGE "tool/grid.png"
tool/grid_snap IMAGE "tool/grid_snap.png"
tool/group IMAGE "tool/group.png"
tool/ungroup IMAGE "tool/ungroup.png"
tool/symmetry_add IMAGE "tool/symmetry_add.png"
tool/symmetry_remove IMAGE "tool/symmetry_remove.png"
combine_or IMAGE "combine_or.png"
combine_sub IMAGE "combine_sub.png"
combine_sub_dark IMAGE "combine_sub_dark.png"
combine_and IMAGE "combine_and.png"
combine_and_dark IMAGE "combine_and_dark.png"
combine_xor IMAGE "combine_xor.png"
combine_over IMAGE "combine_over.png"
combine_border IMAGE "combine_border.png"
symmetry_rotation IMAGE "symmetry_rotation.png"
symmetry_reflection IMAGE "symmetry_reflection.png"
symbol_group IMAGE "symbol_group.png"
icon_combine_merge IMAGE "icon_combine_merge.png"
icon_combine_subtract IMAGE "icon_combine_subtract.png"
icon_combine_intersection IMAGE "icon_combine_intersection.png"
icon_combine_difference IMAGE "icon_combine_difference.png"
icon_combine_overlap IMAGE "icon_combine_overlap.png"
icon_combine_border IMAGE "icon_combine_border.png"
icon_symmetry_rotation IMAGE "icon_symmetry_rotation.png"
icon_symmetry_reflection IMAGE "icon_symmetry_reflection.png"
icon_symbol_group IMAGE "icon_symbol_group.png"
handle_rotate IMAGE "handle_rotate.png"
handle_shear_x IMAGE "handle_shear_x.png"
handle_center IMAGE "handle_center.png"
// -------------------------------------------------------- : Other
sort_asc IMAGE "sort_asc.png"
sort_desc IMAGE "sort_desc.png"
plus IMAGE "plus.png"
minus IMAGE "minus.png"
selected IMAGE "selected_yes.png"
deselected IMAGE "selected_no.png"
bool_yes IMAGE "bool_yes.png"
bool_no IMAGE "bool_no.png"
about IMAGE "about.png"
two_beta IMAGE "two_beta.png"
btn_normal IMAGE "btn_normal.png"
btn_hover IMAGE "btn_hover.png"
btn_focus IMAGE "btn_focus.png"
btn_down IMAGE "btn_down.png"
btn_ok_normal IMAGE "btn_ok_normal.png"
btn_ok_hover IMAGE "btn_ok_hover.png"
btn_ok_focus IMAGE "btn_ok_focus.png"
btn_ok_down IMAGE "btn_ok_down.png"
btn_collapse_normal IMAGE "btn_collapse_normal.png"
btn_collapse_hover IMAGE "btn_collapse_hover.png"
btn_collapse_focus IMAGE "btn_collapse_focus.png"
btn_collapse_down IMAGE "btn_collapse_down.png"
btn_expand_normal IMAGE "btn_expand_normal.png"
btn_expand_hover IMAGE "btn_expand_hover.png"
btn_expand_focus IMAGE "btn_expand_focus.png"
btn_expand_down IMAGE "btn_expand_down.png"
btn_clear_filter_normal IMAGE "btn_clear_filter_normal.png"
btn_clear_filter_hover IMAGE "btn_clear_filter_hover.png"
btn_clear_filter_focus IMAGE "btn_clear_filter_focus.png"
btn_clear_filter_down IMAGE "btn_clear_filter_down.png"
welcome_new IMAGE "welcome_new.png"
welcome_open IMAGE "welcome_open.png"
welcome_last IMAGE "welcome_last.png"
welcome_updates IMAGE "welcome_updates.png"
edit_symbol IMAGE "edit_symbol.png"
installer_group IMAGE "installer_group.png"
installer_package IMAGE "installer_package.png"
installer_locales IMAGE "installer_locales.png"
installer_program IMAGE "installer_program.png"
//installer_font IMAGE "common/installer_font.png"
message_input IMAGE "message_input.png"
message_information IMAGE "message_information.png"
message_warning IMAGE "message_warning.png"
message_error IMAGE "message_error.png"
// -------------------------------------------------------- : WX
//wxBITMAP_STD_COLOURS BITMAP "wx/msw/colours.bmp"
//WXCURSOR_HAND CURSOR DISCARDABLE "wx/msw/hand.cur"
// -------------------------------------------------------- : Other
expected_locale_keys TEXT "expected_locale_keys"
// -------------------------------------------------------- : Version info // -------------------------------------------------------- : Version info
@@ -24,13 +205,12 @@ FILETYPE VFT_APP
{ {
BLOCK "040904E4" BLOCK "040904E4"
{ {
VALUE "FileVersion", "2.0.0" VALUE "FileVersion", "2.0.0"
VALUE "License", "GNU General Public License 2 or later; This is free software, and you are welcome to redistribute it under certain conditions; See the help file for details" VALUE "License", "GNU General Public License 2 or later; This is free software, and you are welcome to redistribute it under certain conditions; See the help file for details"
VALUE "FileDescription", "Magic Set Editor" VALUE "FileDescription", "Magic Set Editor"
VALUE "InternalName", "magicseteditor" VALUE "InternalName", "magicseteditor"
VALUE "LegalCopyright", "\xA9 2001-2011 Twan van Laarhoven and 'coppro'" VALUE "LegalCopyright", "(c) The Magic Set Editor development team"
VALUE "ProductName", "Magic Set Editor" VALUE "ProductName", "Magic Set Editor"
} }
} }
} }
+27 -25
View File
@@ -3,10 +3,19 @@
# Determine the keys that should be in the locale file, # Determine the keys that should be in the locale file,
# and the number of arguments the keys should have # and the number of arguments the keys should have
use strict;
use File::Find;
if (scalar @ARGV != 2) {
die("Usage: $0 <SRCDIR> <OUTFILE>")
}
my $indir = $ARGV[0];
my $outfile = $ARGV[1];
our %found; our %found;
use File::Find; find(\&doit, $indir);
find(\&doit, '../../src');
sub arg_count { sub arg_count {
return scalar split(/,/,$_[0]); return scalar split(/,/,$_[0]);
@@ -35,6 +44,7 @@ sub doit {
close F; close F;
# Custom argument expansion # Custom argument expansion
my $inparen;
$inparen = qr/[^()]|\((??{$inparen})*\)/; # recursive paren matching $inparen = qr/[^()]|\((??{$inparen})*\)/; # recursive paren matching
$body =~ s/format_string\((_[A-Z]+)(_\([^)]+\)),($inparen+)/ $body =~ s/format_string\((_[A-Z]+)(_\([^)]+\)),($inparen+)/
$1 . "_" . arg_count($3) . $2 $1 . "_" . arg_count($3) . $2
@@ -54,7 +64,7 @@ sub find_locale_calls {
# Find calls to locale functions # Find calls to locale functions
while ($body =~ /_(COMMENT_)?(MENU|HELP|TOOL|TOOLTIP|LABEL|BUTTON|TITLE|TYPE|ACTION|ERROR)_(?:([1-9])_)?\(\s*\"([^\"]+)\"/g) { while ($body =~ /_(COMMENT_)?(MENU|HELP|TOOL|TOOLTIP|LABEL|BUTTON|TITLE|TYPE|ACTION|ERROR)_(?:([1-9])_)?\(\s*\"([^\"]+)\"/g) {
$argc = $3 ? $3 : 0; my $argc = $3 ? $3 : 0;
if (defined($found{$2}{$4}{'argc'}) && $found{$2}{$4}{'argc'} != $argc) { if (defined($found{$2}{$4}{'argc'}) && $found{$2}{$4}{'argc'} != $argc) {
print "ERROR: key _$2_($4) used with different arities"; print "ERROR: key _$2_($4) used with different arities";
} }
@@ -68,37 +78,29 @@ sub find_locale_calls {
\s* _ \(\" ([^\"]+) \"\) \s* _ \(\" ([^\"]+) \"\)
@xg @xg
) { ) {
my $key;
($key = $2) =~ s/_/ /g; ($key = $2) =~ s/_/ /g;
foreach $type ("MENU","HELP","TOOL","TOOLTIP") { foreach my $type ("MENU","HELP","TOOL","TOOLTIP") {
$found{$type}{$key}{'opt'} = $in_comment; $found{$type}{$key}{'opt'} = $in_comment;
$found{$type}{$key}{'argc'} = 0; $found{$type}{$key}{'argc'} = 0;
} }
} }
} }
# Now process the items we found, print out a list in MSE reader format # Now process the items we found, write thea list in MSE reader format
my $result; open my $fh, "> $outfile";
my $now = localtime; print $fh "# This file contains the keys expected to be in MSE locales\n";
$result .= "# This file contains the keys expected to be in MSE locales\n"; print $fh "# It was automatically generated by tools/locale/locale.pl\n";
$result .= "# It was automatically generated by tools/locale/locale.pl\n"; print $fh "# Generated on " . localtime . "\n\n";
$result .= "# Generated on " . $now . "\n\n";
my @types = sort keys %found; my @types = sort keys %found;
foreach $type (@types) { foreach my $type (@types) {
$result .= lc($type) . ":\n"; print $fh lc($type) . ":\n";
my @keys = sort keys %{$found{$type}}; my @keys = sort keys %{$found{$type}};
foreach $key (@keys) { foreach my $key (@keys) {
$argc = $found{$type}{$key}{'argc'}; my $argc = $found{$type}{$key}{'argc'};
$opt = $found{$type}{$key}{'opt'} ? 'optional, ' : ''; my $opt = $found{$type}{$key}{'opt'} ? 'optional, ' : '';
$result .= "\t$key:\t$opt$argc\n"; print $fh "\t$key: $opt$argc\n";
} }
} }
# Write to file
open F, "> ../../src/resource/common/expected_locale_keys";
print F $result;
close F;
# and to stdout
#print $result;