You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
97 lines
3.3 KiB
97 lines
3.3 KiB
#!/usr/bin/env python3
|
|
"""
|
|
Fix Japanese translation file: replace English/Chinese placeholders with proper Japanese.
|
|
Brand names (Voitrans, Lily, WeChat, Alipay, PayPal, Apple, Google, Bluetooth, BLE, OTA,
|
|
AI, ASR, TTS, VOITRANS, AIPEN, VoiTrans, DeepSound) are kept as-is.
|
|
"""
|
|
|
|
import re
|
|
|
|
filepath = 'lib/core/translations/language/ja_jp.dart'
|
|
|
|
with open(filepath, 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
|
|
# Each tuple: (old_string, new_string)
|
|
# We use exact string replacement to be safe.
|
|
|
|
replacements = [
|
|
# ---- English-only entries that need translation ----
|
|
|
|
# viewAll
|
|
(" 'viewAll': 'View All',",
|
|
" 'viewAll': 'すべて表示',"),
|
|
|
|
# proMonthly – price tag, keep currency but translate label
|
|
(" 'proMonthly': 'Pro ¥60/month',",
|
|
" 'proMonthly': 'Pro ¥60/月',"),
|
|
|
|
# proMonthlyDesc – multiline
|
|
(" 'proMonthlyDesc':\n '7-day free trial, then ¥800/year. Cancel anytime before trial ends.',",
|
|
" 'proMonthlyDesc':\n '7日間無料トライアル、その後¥800/年。トライアル終了前にいつでもキャンセル可能。',"),
|
|
|
|
# proMonthlyPrice
|
|
(" 'proMonthlyPrice': '¥120/month',",
|
|
" 'proMonthlyPrice': '¥120/月',"),
|
|
|
|
# unlimitedMonthlyPrice
|
|
(" 'unlimitedMonthlyPrice': '¥198/month',",
|
|
" 'unlimitedMonthlyPrice': '¥198/月',"),
|
|
|
|
# currentQuality
|
|
(' "currentQuality": "Current quality: @value%",',
|
|
' "currentQuality": "現在の品質: @value%",'),
|
|
|
|
# currentMaxSize
|
|
(' "currentMaxSize": "Current: @pxpx",',
|
|
' "currentMaxSize": "現在: @pxpx",'),
|
|
|
|
# allStepsCompleted
|
|
(' "allStepsCompleted": "All steps completed",',
|
|
' "allStepsCompleted": "すべてのステップが完了しました",'),
|
|
|
|
# clean / Clear Cache
|
|
(" 'clean': 'Clear Cache',",
|
|
" 'clean': 'キャッシュをクリア',"),
|
|
|
|
# cleanTips
|
|
(" 'cleanTips': 'Are you sure you want to clear personal cache?',",
|
|
" 'cleanTips': '個人キャッシュをクリアしてもよろしいですか?',"),
|
|
|
|
# permissionUtilNeed
|
|
(" 'permissionUtilNeed': 'Need ',",
|
|
" 'permissionUtilNeed': '必要:',"),
|
|
|
|
# iapCustomerServiceQQLabel
|
|
(" 'iapCustomerServiceQQLabel': 'IAP customer service QQ: @qq',",
|
|
" 'iapCustomerServiceQQLabel': 'IAP カスタマーサービス QQ: @qq',"),
|
|
|
|
# tsransit (transit / 公交)
|
|
(' "tsransit": "Transit",',
|
|
' "tsransit": "乗り換え",'),
|
|
|
|
# sixThousandMinutes / threeThousandMinutes / sixHundredMinutes / oneHundredTwentyMinutes
|
|
(" 'sixThousandMinutes': '6,000 minutes',",
|
|
" 'sixThousandMinutes': '6,000分',"),
|
|
(" 'threeThousandMinutes': '3,000 minutes',",
|
|
" 'threeThousandMinutes': '3,000分',"),
|
|
(" 'sixHundredMinutes': '600 minutes',",
|
|
" 'sixHundredMinutes': '600分',"),
|
|
(" 'oneHundredTwentyMinutes': '120 minutes',",
|
|
" 'oneHundredTwentyMinutes': '120分',"),
|
|
]
|
|
|
|
original = content
|
|
for old, new in replacements:
|
|
if old in content:
|
|
content = content.replace(old, new)
|
|
print(f'REPLACED: {repr(old[:60])}')
|
|
else:
|
|
print(f'NOT FOUND: {repr(old[:60])}')
|
|
|
|
if content != original:
|
|
with open(filepath, 'w', encoding='utf-8') as f:
|
|
f.write(content)
|
|
print('\nFile updated successfully.')
|
|
else:
|
|
print('\nNo changes made.')
|
|
|