oct 翻译更新
This commit is contained in:
parent
629632af57
commit
d549f0af1f
186
octl/en_US.json
186
octl/en_US.json
@ -1,186 +0,0 @@
|
||||
{
|
||||
"room_surface": [
|
||||
"* Everything's so strange...",
|
||||
"* This can't be happening...",
|
||||
"* No one would just fall off a cliff like that! \n* I don't believe it!",
|
||||
"* Is there something special\n about this cliff?",
|
||||
"* I... I have to go there and\n find out what's going on!",
|
||||
"",
|
||||
"* Hey, Frida,\n are you still awake?",
|
||||
"* Yeah...",
|
||||
"* Wanna eat another\n midnight snack?",
|
||||
"* No.",
|
||||
"* Alright.",
|
||||
"* If you need anything,\n I'll be in my room.",
|
||||
"* I see.",
|
||||
"",
|
||||
"* This sofa is so soft.",
|
||||
"* It's really comfy to sit on.",
|
||||
"",
|
||||
"* I love this fridge.",
|
||||
"* But it's almost always empty.",
|
||||
"",
|
||||
"* Is this lasagna?",
|
||||
"* It's so hard...",
|
||||
"* Is this really lasagna?",
|
||||
"* Whatever, I'll take it.",
|
||||
"* I got a piece of\n rock-hard lasagna.",
|
||||
"",
|
||||
"* This is my dad.",
|
||||
"* Frida, what's up?",
|
||||
"* Nothing much.",
|
||||
"* You look tired...",
|
||||
"* Why don't you go to bed?",
|
||||
"* Alright...\n* Goodnight, love you.",
|
||||
"",
|
||||
"* This is my bed.",
|
||||
"* It's super soft and comfy.",
|
||||
"",
|
||||
"* My closet is full of clothes.",
|
||||
"* My mom's a designer,\n so she makes me cool outfits.",
|
||||
"* But she's working abroad\n right now...\n* I miss her.",
|
||||
"",
|
||||
"* My desk where\n I do schoolwork.",
|
||||
"* My computer has\n all the stories I write.",
|
||||
"* Only my online friend likes them...\n * But we'll probably never meet\n in person.",
|
||||
"",
|
||||
"* I love reading.",
|
||||
"* Wait... I think there was a book here\n that I didn't finish.",
|
||||
"* Where did it go?",
|
||||
"",
|
||||
"* My dream bookshelf,\n full of interesting books.",
|
||||
"",
|
||||
"* This plant looks like wheat,\n but it's red.",
|
||||
"",
|
||||
"* My fireplace keeps me\n warm in winter.",
|
||||
"* The TV on top is\n hardly ever used.",
|
||||
"",
|
||||
"* My parents' bed.",
|
||||
"",
|
||||
"* Oh, this is the painting\n I gave my mom for her birthday.",
|
||||
"",
|
||||
"* My bathroom.",
|
||||
"* Bubbles, warm water...\n* Sometimes it's better\n than a hot spring.",
|
||||
"",
|
||||
"* This sink is so high.",
|
||||
"",
|
||||
"* This is the gas stove.",
|
||||
"* Dad told me not to go near it\n or light it.\n * He says it's dangerous.",
|
||||
"",
|
||||
"* This is the cutting board.",
|
||||
"* Where we keep utensils...\n * And the shrine for oven mitts.",
|
||||
"",
|
||||
"* Our dining table\n where we eat together.",
|
||||
"* I remember those long chats.\n* I wish Mom would come back\n from her business trip.\n* She's in another country.\n* I love my parents!",
|
||||
"",
|
||||
"* Various tools.",
|
||||
"",
|
||||
"* The sink for washing dishes\n and veggies.",
|
||||
"* I once accidentally dropped\n one of Mom's pieces of jewelry in here.",
|
||||
"",
|
||||
"* If I leave home now,\n I might not be back\n for a long time.",
|
||||
"* (Start the adventure?)\n\nYes No",
|
||||
"",
|
||||
"* No turning back...",
|
||||
"",
|
||||
"* A missing child poster.",
|
||||
"* It looks old...\n * At least ten years old...\n * Maybe even older...",
|
||||
"",
|
||||
"* Everything seems\n normal here...",
|
||||
"",
|
||||
"* Why do people keep\n disappearing here?",
|
||||
"",
|
||||
"* A beautiful forest.\n * Is there something wrong\n with it?",
|
||||
"",
|
||||
"* There's the cliff!",
|
||||
"",
|
||||
"* What a view!\n * I can see the city lights\n in the distance...",
|
||||
"",
|
||||
"* What's that?"
|
||||
],
|
||||
"room_ruin_start": [
|
||||
"* I fell onto these flowers.",
|
||||
"* They're called Aquacyans.",
|
||||
"* I read that these flowers\nallow breathing underwater!",
|
||||
"* Wow! That's amazing!",
|
||||
"",
|
||||
"* These are Aquacyans.",
|
||||
"* They enable underwater breathing.",
|
||||
"",
|
||||
"* What happened?",
|
||||
"",
|
||||
"* Don't worry about me,\n child...",
|
||||
"* Keep moving forward...",
|
||||
"* Don't stop...",
|
||||
""
|
||||
],
|
||||
"room_ruin_corally": [
|
||||
"* Hi! I'm Corally.\n* A coral named Corally!",
|
||||
"* Hmm...",
|
||||
"* You're new to this ocean,\n right?",
|
||||
"* Goodness, you must be lost.",
|
||||
"* You definitely need someone\n to help you figure things out!",
|
||||
"* And obviously, that someone\n is me.",
|
||||
"* Ready?\n* Let's begin!",
|
||||
"",
|
||||
"* Don't you have anything\nbetter to do?",
|
||||
"",
|
||||
"* Let's go!",
|
||||
""
|
||||
],
|
||||
"room_ruin1": [
|
||||
"* After falling into these ruins,\n I'm filled with PATIENCE...",
|
||||
"* ...just to escape this place...",
|
||||
"",
|
||||
"",
|
||||
"* A bandana.",
|
||||
"* Take the bandana?\n\n Take it Leave it",
|
||||
"* I obtained the bandana.",
|
||||
"",
|
||||
"* I have no room for it!",
|
||||
"",
|
||||
""
|
||||
],
|
||||
"room_ruin2": [
|
||||
"* Welcome to the ruins,\n this is your new home now, child!",
|
||||
"* Hmm. It's rather rude\n to keep calling you that...",
|
||||
"* Precious child...\n* Do you... have a name?",
|
||||
"* My name is... Frida...",
|
||||
"* Frida? What a\nlovely name!",
|
||||
"* Then... let's begin!",
|
||||
"* As I said, this is\nyour new home, Frida!",
|
||||
"* The underwater ruins\nare full of puzzles.",
|
||||
"* Try solving this one!",
|
||||
"* You just need to\npress three buttons.",
|
||||
"* There's a clue somewhere\naround here.",
|
||||
"* Good luck!",
|
||||
"",
|
||||
"* Well done!\nLet's go to the next room.",
|
||||
"",
|
||||
"* 1\n 0\n 1\n 1",
|
||||
"* This must be the clue.",
|
||||
""
|
||||
],
|
||||
"room_ruin3": [
|
||||
"* Oh, the crystal is\nout of place again?",
|
||||
"* To proceed, you must\npush it back.",
|
||||
"* But now it's surrounded\nby spikes.",
|
||||
"* If you want to pass,\nyou'll need to retract the spikes.",
|
||||
"* I believe you can solve\nthis puzzle alone.",
|
||||
"* Come on, it's not that hard.",
|
||||
"* Just be quick about it.",
|
||||
"* And...",
|
||||
"* Be careful!",
|
||||
"",
|
||||
"* You are not fast enough.\n* Try again!",
|
||||
"",
|
||||
"* Well done! You're amazing!",
|
||||
"* Now go move the crystal!",
|
||||
"",
|
||||
"* Congratulations! You solved\nthe puzzle on your own!",
|
||||
"* Let's go to the next room.",
|
||||
"",
|
||||
"* It says: \n\"Beware the towering cliffs!\"",
|
||||
""
|
||||
]
|
||||
}
|
2156
octl/room/en_US.json
Normal file
2156
octl/room/en_US.json
Normal file
File diff suppressed because it is too large
Load Diff
6107
octl/room/en_US.po
6107
octl/room/en_US.po
File diff suppressed because it is too large
Load Diff
73
octl/room/oct_l10n_tools.py
Normal file
73
octl/room/oct_l10n_tools.py
Normal file
@ -0,0 +1,73 @@
|
||||
import json
|
||||
import polib
|
||||
|
||||
|
||||
def extract_and_deduplicate(data):
|
||||
"""
|
||||
遍历 JSON 数据,去重并生成新的 JSON 格式
|
||||
"""
|
||||
new_json = {}
|
||||
index = 0
|
||||
|
||||
for key, values in data.items():
|
||||
seen = set()
|
||||
count = 0
|
||||
|
||||
for value in values:
|
||||
value = value.strip()
|
||||
if value and value not in seen:
|
||||
new_key = f"{index}-{key}-{count}"
|
||||
new_json[new_key] = value
|
||||
seen.add(value)
|
||||
count += 1
|
||||
|
||||
if len(values) > 0:
|
||||
index += 1
|
||||
|
||||
return new_json
|
||||
|
||||
|
||||
def json_to_new_json(input_file, output_file):
|
||||
"""
|
||||
读取 JSON 文件,去重后写入新 JSON 文件
|
||||
"""
|
||||
with open(input_file, "r", encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
|
||||
new_data = extract_and_deduplicate(data)
|
||||
|
||||
with open(output_file, "w", encoding="utf-8") as f:
|
||||
json.dump(new_data, f, ensure_ascii=False, indent=4)
|
||||
|
||||
print(f"新 JSON 文件已保存至: {output_file}")
|
||||
|
||||
|
||||
def load_translations(po_file):
|
||||
"""
|
||||
读取 PO 文件并构建 msgid 到 msgstr 的映射
|
||||
"""
|
||||
translations = {}
|
||||
po = polib.pofile(po_file)
|
||||
|
||||
for entry in po:
|
||||
if entry.msgstr:
|
||||
translations[entry.msgid] = entry.msgstr
|
||||
|
||||
return translations
|
||||
|
||||
|
||||
def translate_json(input_json, po_file, output_json):
|
||||
"""
|
||||
读取 JSON 文件,匹配翻译并生成新 JSON 文件
|
||||
"""
|
||||
with open(input_json, "r", encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
|
||||
translations = load_translations(po_file)
|
||||
|
||||
new_data = {key: translations.get(value, "") for key, value in data.items()}
|
||||
|
||||
with open(output_json, "w", encoding="utf-8") as f:
|
||||
json.dump(new_data, f, ensure_ascii=False, indent=4)
|
||||
|
||||
print(f"翻译后的 JSON 文件已保存至: {output_json}")
|
3142
octl/room/original.json
Normal file
3142
octl/room/original.json
Normal file
File diff suppressed because it is too large
Load Diff
4074
octl/room/ru_RU.json
4074
octl/room/ru_RU.json
File diff suppressed because it is too large
Load Diff
5795
octl/room/ru_RU.pot
5795
octl/room/ru_RU.pot
File diff suppressed because it is too large
Load Diff
2156
octl/room/zh_CN.json
Normal file
2156
octl/room/zh_CN.json
Normal file
File diff suppressed because it is too large
Load Diff
5838
octl/room/zh_CN.po
5838
octl/room/zh_CN.po
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user