feat: translate flight tutorial for next in-game trial
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
"""Flight tutorial text fits the existing dialog using actual engine layout."""
|
||||
import json
|
||||
from pathlib import Path
|
||||
import unittest
|
||||
from test_cjk_layout import layout
|
||||
|
||||
|
||||
class FlightTests(unittest.TestCase):
|
||||
def test_flight_instructions_fit_and_share_dialog_center(self):
|
||||
mapping = json.loads(Path(__file__).with_name('tutorial_cn.json').read_text(encoding='utf-8'))
|
||||
bodies = [v for k, v in mapping.items() if k.startswith('\fYou can fly')]
|
||||
self.assertEqual(len(bodies), 2)
|
||||
self.assertEqual(bodies[0], bodies[1])
|
||||
for body in bodies:
|
||||
for width in (360, 400, 480):
|
||||
lines, _ = layout(body, width=width, alignment=0)
|
||||
self.assertEqual(len(lines), 2)
|
||||
for raw, x, y in lines:
|
||||
text = raw.decode('gb2312')
|
||||
self.assertEqual(x, (width - len(text) * 12) // 2)
|
||||
self.assertNotIn(text[0], ',。;:、')
|
||||
self.assertEqual(lines[1][2] - lines[0][2], 17)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -7,5 +7,8 @@
|
||||
"Center the camera": "镜头回正",
|
||||
"\fTo bring the camera into the default position behind the dragon press on the \"5\" key on the numeric keypad.": "\f按数字小键盘上的 5 键,将镜头恢复到巨龙身后的默认视角。",
|
||||
"Zoom": "缩放视角",
|
||||
"\fYou can zoom the camera by rotating the mouse wheel or by pressing the \"+\" and \"-\" keys on the numeric keypad.": "\f滚动鼠标滚轮,或按数字小键盘上的 +、- 键,可拉近或拉远视角。"
|
||||
"\fYou can zoom the camera by rotating the mouse wheel or by pressing the \"+\" and \"-\" keys on the numeric keypad.": "\f滚动鼠标滚轮,或按数字小键盘上的 +、- 键,可拉近或拉远视角。",
|
||||
"Flight": "飞行",
|
||||
"\fYou can fly using the mouse or the keyboard. Just left-click anywhere - and your dragon will fly there (note the indicator that appears there with a light globe that marks your dragon's altitude).\n\fYou can also use the keyboard to fly: up arrow moves forward, left and right arrow keys steer.": "\u0007左键点击目的地即可飞行,光球表示飞行高度。\n\u0007也可用方向键:上键前进,左、右键转向。",
|
||||
"\fYou can fly using the mouse or the keyboard. Just left-click anywhere - and your dragon will fly there (note the indicator that appears there with a light globe that marks your dragon's altitude).\n\fYou can also use the keyboard to fly: up arrow moves forward, left and right arrow keys steer.": "\u0007左键点击目的地即可飞行,光球表示飞行高度。\n\u0007也可用方向键:上键前进,左、右键转向。"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Verify the bounded first tutorial translation against an original backup."""
|
||||
"""Verify the bounded first five tutorial groups against an original backup."""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
@@ -38,8 +38,8 @@ def main():
|
||||
assert source[a.start:a.end] == result[b.start:b.end]
|
||||
left, right = a.end, b.end
|
||||
assert source[left:] == result[right:], 'trailing bytes changed'
|
||||
assert changed == list(range(12)), changed
|
||||
print('MODIFIED: first 12 of 55 literals translated; all other bytes unchanged; PASS')
|
||||
assert changed == list(range(15)), changed
|
||||
print('MODIFIED: first 15 of 55 literals translated; all other bytes unchanged; PASS')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user