Ren'Py Translator ToolKit  Check-in [3c8f1d82ad]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Mark obsolete translation blocks
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:3c8f1d82ad3954c920cf4b7628b4c0991fc55ae2faff354b65f8ea0656d38111
User & Date: Beuc 2020-04-16 21:31:43
Context
2020-04-25
15:40
Bump version check-in: 1d1e4616d2 user: Beuc tags: trunk
2020-04-16
21:31
Mark obsolete translation blocks check-in: 3c8f1d82ad user: Beuc tags: trunk
2020-04-15
14:59
Clarification on .rpy/.rpyc files check-in: 71eeb6e4c4 user: Beuc tags: trunk
Changes

Changes to functest.sh.

5
6
7
8
9
10
11




















12
13
14
15
16
17
18
19
20
21
cp -a test/input/*.rpy "$projectpath/game"

renpy.sh . tl2pot "$projectpath"

msgmerge -v test/input/testtl-fr_FR.po game.pot -o "$projectpath/testtl-fr_FR.po"

renpy.sh . mo2tl "$projectpath" "$projectpath/testtl-fr_FR.po" french




















rm -f "$projectpath/game/tl/french/common.rpy"
sed -i -e 's/# TODO: Translation updated at .*/# TODO: Translation updated at XXXX-XX-XX XX:XX/' "$projectpath/game/tl/french/"*.rpy

diff -ru test/output_expected $projectpath/game/tl/french

# TODO: check result but PO editors' reformatting makes it difficult
renpy.sh . tl2po "$projectpath" french

rm -f game.pot french.po
rm -rf "$projectpath"







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|









5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
cp -a test/input/*.rpy "$projectpath/game"

renpy.sh . tl2pot "$projectpath"

msgmerge -v test/input/testtl-fr_FR.po game.pot -o "$projectpath/testtl-fr_FR.po"

renpy.sh . mo2tl "$projectpath" "$projectpath/testtl-fr_FR.po" french

# obsolete entry
cat <<EOF >> "$projectpath/game/tl/french/script.rpy"
# game/script.rpy:1
translate french start_baaaaaad:

    # e "obsolete entry"
    e "entrée obsolète"

# game/script.rpy:2
# OBSOLETE
translate french start_badddddd:

    # e "obsolete entry 2"
    e "entrée obsolète 2"

EOF

renpy.sh . mo2tl "$projectpath" "$projectpath/testtl-fr_FR.po" french

rm -f "$projectpath/game/tl/french/common.rpy" "$projectpath/game/tl/french/"*.rpyc
sed -i -e 's/# TODO: Translation updated at .*/# TODO: Translation updated at XXXX-XX-XX XX:XX/' "$projectpath/game/tl/french/"*.rpy

diff -ru test/output_expected $projectpath/game/tl/french

# TODO: check result but PO editors' reformatting makes it difficult
renpy.sh . tl2po "$projectpath" french

rm -f game.pot french.po
rm -rf "$projectpath"

Changes to mo2tl.py.

155
156
157
158
159
160
161

162
163
164
165
166

167
168
169
170
171
172
173
...
202
203
204
205
206
207
208




209
210
211
212
213
214
215
            scriptpath = os.path.join(curdir,filename)
            f_in = io.open(scriptpath, 'r', encoding='utf-8-sig')
            lines = f_in.readlines()
            lines.reverse()  # reverse so we can pop/append efficiently
            f_in.close()
        
            out = io.open(scriptpath, 'w', encoding='utf-8-sig')

            while len(lines) > 0:
                line = lines.pop()
                if rttk.tlparser.is_empty(line):
                    out.write(line)
                elif rttk.tlparser.is_comment(line):

                    out.write(line)
                elif rttk.tlparser.is_block_start(line):
                    msgid = line.strip(':\n').split()[2]
                    if msgid == 'strings':
                        # basic strings block
                        out.write(line)
                        s = None
................................................................................
                                translation = None
                            else:
                                # unknown
                                pass
                            out.write(line)
                    else:
                        # dialog block




                        out.write(line)
                        while len(lines) > 0:
                            line = lines.pop()
                            if rttk.tlparser.is_empty(line):
                                pass
                            elif not line.startswith(' '):
                                # end of block







>





>







 







>
>
>
>







155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
...
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
            scriptpath = os.path.join(curdir,filename)
            f_in = io.open(scriptpath, 'r', encoding='utf-8-sig')
            lines = f_in.readlines()
            lines.reverse()  # reverse so we can pop/append efficiently
            f_in.close()
        
            out = io.open(scriptpath, 'w', encoding='utf-8-sig')
            last_comment = ''
            while len(lines) > 0:
                line = lines.pop()
                if rttk.tlparser.is_empty(line):
                    out.write(line)
                elif rttk.tlparser.is_comment(line):
                    last_comment = line
                    out.write(line)
                elif rttk.tlparser.is_block_start(line):
                    msgid = line.strip(':\n').split()[2]
                    if msgid == 'strings':
                        # basic strings block
                        out.write(line)
                        s = None
................................................................................
                                translation = None
                            else:
                                # unknown
                                pass
                            out.write(line)
                    else:
                        # dialog block
                        if o_blocks_index.get(msgid, None) is None:
                            obsolete = u"# OBSOLETE\n"
                            if last_comment != obsolete:
                                out.write(obsolete)
                        out.write(line)
                        while len(lines) > 0:
                            line = lines.pop()
                            if rttk.tlparser.is_empty(line):
                                pass
                            elif not line.startswith(' '):
                                # end of block

Changes to test/output_expected/script.rpy.

81
82
83
84
85
86
87

88
89
90
91
92
93
94
...
168
169
170
171
172
173
174














# game/script.rpy:53
translate french start_cb471577:

    # e "single-quoted \" string"
    e "chaîne de caractères entre guillemets simples dup2"

# game/script.rpy:56

translate french start_76b2fe88:

    # nvl clear
    nvl clear

# game/script.rpy:59
translate french start_c9a35125:
................................................................................
    old "dupmenutitle"
    new "dupmenutitre"

    # game/script.rpy:85
    old "dupmenuentry"
    new "dupmenuentrée"






















>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
...
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# game/script.rpy:53
translate french start_cb471577:

    # e "single-quoted \" string"
    e "chaîne de caractères entre guillemets simples dup2"

# game/script.rpy:56
# OBSOLETE
translate french start_76b2fe88:

    # nvl clear
    nvl clear

# game/script.rpy:59
translate french start_c9a35125:
................................................................................
    old "dupmenutitle"
    new "dupmenutitre"

    # game/script.rpy:85
    old "dupmenuentry"
    new "dupmenuentrée"

# game/script.rpy:1
# OBSOLETE
translate french start_baaaaaad:

    # e "obsolete entry"
    e "entrée obsolète"

# game/script.rpy:2
# OBSOLETE
translate french start_badddddd:

    # e "obsolete entry 2"
    e "entrée obsolète 2"