Skip to content

Commit 01fe5ad

Browse files
committed
Added import test to fix import for parse_rc
Fixes #92
1 parent 6c6a7a8 commit 01fe5ad

11 files changed

Lines changed: 290 additions & 1 deletion

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ script:
77
- perl Build.PL && ./Build && ./Build test
88
- cover -delete
99
- perl -MDevel::Cover t/engine.t
10+
- perl -MDevel::Cover t/importer.t
1011
after_success:
1112
- cover -report codecov
1213
perl:

lib/Serge/Engine/Plugin/parse_rc.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ sub parse {
8686
if ($orig_str) {
8787
my $str = $orig_str;
8888
$str =~ s/""/"/g;
89-
$translated_str = &$callbackref($str, undef, $hint, undef, $lang);
89+
$translated_str = &$callbackref($str, undef, $hint, undef, $lang, $idstr);
9090
}
9191

9292
if ($lang) {

t/data/importer/common.serge

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
job_template
2+
{
3+
name Test Job
4+
id test_job
5+
active YES
6+
source_language en
7+
destination_languages test
8+
source_dir ./resources
9+
db_source DBI:SQLite:dbname=:memory:
10+
db_namespace test_namespace
11+
ts_file_path ./test-output/po/%LOCALE%/%FILE%.po
12+
output_bom NO
13+
output_file_path ./test-output/localized-resources/%LOCALE%/%FILE%
14+
15+
callback_plugins
16+
{
17+
:test_language
18+
{
19+
plugin test_language
20+
phase get_translation_pre
21+
22+
data
23+
{
24+
save_translations YES
25+
}
26+
}
27+
}
28+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
files
2+
{
3+
0 1 1 test_job test_namespace application.rc 0
4+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
items
2+
{
3+
0 1 3 1 1 IDS_TEST_1 NO 0
4+
1 2 5 1 2 IDS_TEST_2 NO 0
5+
2 3 7 1 3 IDS_ERROR NO 0
6+
3 4 9 1 4 IDS_TEST_3 NO 0
7+
4 5 11 1 5 IDS_TEST_4 NO 0
8+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
properties
2+
{
3+
0 1 source:1 b88e2e32e7cd852f7d4b76ba913a78a1
4+
1 2 hash:1 b88e2e32e7cd852f7d4b76ba913a78a1
5+
2 3 size:1 923
6+
3 4 items:1 1,2,3,4,5
7+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
strings
2+
{
3+
0 1 2 `Value 1` NO 0
4+
1 2 4 `Value 2` NO 0
5+
2 3 6 `Error %s` NO 0
6+
3 4 8 `Value 3` NO 0
7+
4 5 10 `Value 4` NO 0
8+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
translations
2+
{
3+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Microsoft Visual C++ generated resource script.
2+
//
3+
#include "resource.h"
4+
5+
/////////////////////////////////////////////////////////////////////////////
6+
//
7+
// Test Version
8+
//
9+
10+
VS_VERSION_INFO VERSIONINFO
11+
VERSION 1,0,0,1111
12+
PRODUCTVERSION 4,0,0,1111
13+
FILEFLAGSMASK 0x12L
14+
BEGIN
15+
BLOCK "StringFileInfo"
16+
BEGIN
17+
BLOCK "040904b0"
18+
BEGIN
19+
VALUE "Sample Name", "Sample Name Value"
20+
VALUE "Description", "Good description"
21+
VALUE "Version", "1,0,0,1111"
22+
END
23+
END
24+
BLOCK "VarFileInfo"
25+
BEGIN
26+
VALUE "Alternative", 0x409, 1200
27+
END
28+
END
29+
30+
/////////////////////////////////////////////////////////////////////////////
31+
//
32+
// Test Strings
33+
//
34+
35+
STRINGTABLE
36+
BEGIN
37+
IDS_TEST_1 "Value 1"
38+
IDS_TEST_2 "Value 2"
39+
IDS_ERROR "Error %s"
40+
END
41+
42+
STRINGTABLE
43+
BEGIN
44+
IDS_TEST_3
45+
"Value 3"
46+
IDS_TEST_4 "Value 4"
47+
END
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
jobs
2+
{
3+
{
4+
@inherit ../../common.serge#job_template
5+
6+
source_match \.rc$
7+
8+
parser
9+
{
10+
plugin parse_rc
11+
}
12+
}
13+
}

0 commit comments

Comments
 (0)