Add source lines to file locations on POT generation
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
</brief_description>
|
||||
<description>
|
||||
[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.
|
||||
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.
|
||||
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.
|
||||
The extracted strings will be written into a POT file selected by user under "POT Generation" in "Localization" tab in "Project Settings" menu.
|
||||
Below shows an example of a custom parser that extracts strings from a CSV file to write into a POT.
|
||||
[codeblocks]
|
||||
@ -54,19 +54,19 @@
|
||||
}
|
||||
[/csharp]
|
||||
[/codeblocks]
|
||||
To add a translatable string associated with a context, plural, or comment:
|
||||
To add a translatable string associated with a context, plural, comment, or source line:
|
||||
[codeblocks]
|
||||
[gdscript]
|
||||
# This will add a message with msgid "Test 1", msgctxt "context", msgid_plural "test 1 plurals", and comment "test 1 comment".
|
||||
ret.append(PackedStringArray(["Test 1", "context", "test 1 plurals", "test 1 comment"]))
|
||||
# This will add a message with msgid "Test 1", msgctxt "context", msgid_plural "test 1 plurals", comment "test 1 comment", and source line "7".
|
||||
ret.append(PackedStringArray(["Test 1", "context", "test 1 plurals", "test 1 comment", "7"]))
|
||||
# This will add a message with msgid "A test without context" and msgid_plural "plurals".
|
||||
ret.append(PackedStringArray(["A test without context", "", "plurals"]))
|
||||
# This will add a message with msgid "Only with context" and msgctxt "a friendly context".
|
||||
ret.append(PackedStringArray(["Only with context", "a friendly context"]))
|
||||
[/gdscript]
|
||||
[csharp]
|
||||
// This will add a message with msgid "Test 1", msgctxt "context", msgid_plural "test 1 plurals", and comment "test 1 comment".
|
||||
ret.Add(["Test 1", "context", "test 1 plurals", "test 1 comment"]);
|
||||
// This will add a message with msgid "Test 1", msgctxt "context", msgid_plural "test 1 plurals", comment "test 1 comment", and source line "7".
|
||||
ret.Add(["Test 1", "context", "test 1 plurals", "test 1 comment", "7"]);
|
||||
// This will add a message with msgid "A test without context" and msgid_plural "plurals".
|
||||
ret.Add(["A test without context", "", "plurals"]);
|
||||
// This will add a message with msgid "Only with context" and msgctxt "a friendly context".
|
||||
|
||||
Reference in New Issue
Block a user