|
5 | 5 | </brief_description> |
6 | 6 | <description> |
7 | 7 | [EditorTranslationParserPlugin] is invoked when a file is being parsed to extract strings that require translation. To define the parsing and string extraction logic, override the [method _parse_file] method in script. |
8 | | - The return value should be an [Array] of [PackedStringArray]s, one for each extracted translatable string. Each entry should contain [code][msgid, msgctxt, msgid_plural, comment][/code], where all except [code]msgid[/code] are optional. Empty strings will be ignored. |
| 8 | + The return value should be an [Array] of [PackedStringArray]s, one for each extracted translatable string. Each entry should contain [code][msgid, msgctxt, msgid_plural, comment, source_line][/code], where all except [code]msgid[/code] are optional. Empty strings will be ignored. |
9 | 9 | The extracted strings will be written into a POT file selected by user under "POT Generation" in "Localization" tab in "Project Settings" menu. |
10 | 10 | Below shows an example of a custom parser that extracts strings from a CSV file to write into a POT. |
11 | 11 | [codeblocks] |
|
54 | 54 | } |
55 | 55 | [/csharp] |
56 | 56 | [/codeblocks] |
57 | | - To add a translatable string associated with a context, plural, or comment: |
| 57 | + To add a translatable string associated with a context, plural, comment, or source line: |
58 | 58 | [codeblocks] |
59 | 59 | [gdscript] |
60 | | - # This will add a message with msgid "Test 1", msgctxt "context", msgid_plural "test 1 plurals", and comment "test 1 comment". |
61 | | - ret.append(PackedStringArray(["Test 1", "context", "test 1 plurals", "test 1 comment"])) |
| 60 | + # This will add a message with msgid "Test 1", msgctxt "context", msgid_plural "test 1 plurals", comment "test 1 comment", and source line "7". |
| 61 | + ret.append(PackedStringArray(["Test 1", "context", "test 1 plurals", "test 1 comment", "7"])) |
62 | 62 | # This will add a message with msgid "A test without context" and msgid_plural "plurals". |
63 | 63 | ret.append(PackedStringArray(["A test without context", "", "plurals"])) |
64 | 64 | # This will add a message with msgid "Only with context" and msgctxt "a friendly context". |
65 | 65 | ret.append(PackedStringArray(["Only with context", "a friendly context"])) |
66 | 66 | [/gdscript] |
67 | 67 | [csharp] |
68 | | - // This will add a message with msgid "Test 1", msgctxt "context", msgid_plural "test 1 plurals", and comment "test 1 comment". |
69 | | - ret.Add(["Test 1", "context", "test 1 plurals", "test 1 comment"]); |
| 68 | + // This will add a message with msgid "Test 1", msgctxt "context", msgid_plural "test 1 plurals", comment "test 1 comment", and source line "7". |
| 69 | + ret.Add(["Test 1", "context", "test 1 plurals", "test 1 comment", "7"]); |
70 | 70 | // This will add a message with msgid "A test without context" and msgid_plural "plurals". |
71 | 71 | ret.Add(["A test without context", "", "plurals"]); |
72 | 72 | // This will add a message with msgid "Only with context" and msgctxt "a friendly context". |
|
0 commit comments