Skip to content

Commit b260bde

Browse files
committed
Use source path when importing
Fixed parsing rc file and import test
1 parent 5831284 commit b260bde

4 files changed

Lines changed: 11 additions & 4 deletions

File tree

lib/Serge/Engine/Plugin/parse_rc.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ sub parse {
7171
# STRINGTABLE BEGIN...END block contents
7272
} elsif ($stringtable && $blocklevel) {
7373
if ($line =~ m/^[\t ]*(\w+)[\t ]+"((.*?("")*)*?)"/) { # test for one-line string definitions
74-
$hint = $1;
74+
$idstr = $1;
75+
$hint = $idstr;
7576
$orig_str = $2;
7677
} elsif ($line =~ m/^[\t ]*(\w+)[\t ]*(\/\/.*)*$/) { # test for the first line (id) of the two-line string definitions
7778
$idstr = $1;

lib/Serge/Importer.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ sub parse_localized_files_for_file_lang {
104104

105105
$self->{current_lang} = $lang;
106106

107-
my $fullpath = $self->get_full_output_path($file, $lang);
107+
my $fullpath = $self->get_full_source_path($file, $lang);
108108

109109
$self->{stats}->{$lang} = {} unless exists $self->{stats}->{$lang};
110110

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
translations
22
{
3+
0 1 12 1 test `Value 1` NO 0 0
4+
1 2 13 2 test `Value 2` NO 0 0
5+
2 3 14 3 test `Error %s` NO 0 0
6+
3 4 15 4 test `Value 3` NO 0 0
7+
4 5 16 5 test `Value 4` NO 0 0
38
}

t/importer.t

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ $| = 1; # disable output buffering
3636

3737
# to get the same results between tests,
3838
# we override the `file_mtime` function to return a constant value;
39-
# Serge::Importer automatically imports this function from Serge::Util
39+
# Serge::Engine automatically imports this function from Serge::Util
4040
# (this is why it actually appears in Serge::Importer namespace)
41-
sub Serge::Importer::file_mtime {
41+
sub Serge::Engine::file_mtime {
4242
return 12345678;
4343
}
4444

@@ -112,6 +112,7 @@ for my $config_file (@importer_confs) {
112112
foreach my $job_data (@{$cfg->{data}->{jobs}}) {
113113
my $job;
114114

115+
$engine->{debug} = $job_data->{debug};
115116
eval {
116117
$job = Serge::Engine::Job->new($job_data, $engine, $cfg->{base_dir});
117118
$engine->process_job($job);

0 commit comments

Comments
 (0)