-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update * use json locale files
- Loading branch information
Showing
11 changed files
with
379 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.10.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from pathlib import Path | ||
import json | ||
import argparse | ||
|
||
# Recursive function to find missing keys in dictionaries | ||
def find_missing_keys(base_dict, other_dict): | ||
missing_keys = {} | ||
for key in base_dict: | ||
if key not in other_dict: | ||
missing_keys[key] = base_dict[key] | ||
elif isinstance(base_dict[key], dict) and isinstance(other_dict[key], dict): | ||
sub_missing_keys = find_missing_keys(base_dict[key], other_dict[key]) | ||
if sub_missing_keys: | ||
missing_keys[key] = sub_missing_keys | ||
return missing_keys | ||
|
||
|
||
|
||
def check_locales(dir_name: str, base_locale: str = 'zh-CN'): | ||
# Load the zh-CN JSON file | ||
zh_cn_file = Path(dir_name) / f'{base_locale}.json' | ||
with zh_cn_file.open('r') as f: | ||
zh_cn = json.load(f) | ||
|
||
# Look for other JSON files in the current directory | ||
for file in Path(dir_name).glob('*.json'): | ||
cur_locale = file.stem | ||
if cur_locale != base_locale: | ||
with file.open('r') as f: | ||
other_dict = json.load(f) | ||
missing_keys = find_missing_keys(zh_cn, other_dict) | ||
print(f'\n\n please translate to {cur_locale}:', missing_keys) | ||
|
||
if __name__ == '__main__': | ||
parser = argparse.ArgumentParser(description='Check missing keys in language localization files') | ||
parser.add_argument('dir_name', type=str, help='directory where the JSON files are located') | ||
parser.add_argument('--base', type=str, default='zh-CN', help='base locale to compare against') | ||
args = parser.parse_args() | ||
check_locales(args.dir_name, args.base) | ||
# python check_locales.py /path/to/locales --base en-US |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
{ | ||
"common": { | ||
"help": "The first one is the theme(prompt), and the context includes 10 messages.", | ||
"edit": "Edit", | ||
"delete": "Delete", | ||
"save": "Save", | ||
"reset": "Reset", | ||
"export": "Export", | ||
"import": "Import", | ||
"clear": "Clear", | ||
"yes": "Yes", | ||
"no": "No", | ||
"noData": "No data available", | ||
"wrong": "Something seems to have gone wrong. Please try again later.", | ||
"success": "Operation succeeded", | ||
"failed": "Operation failed", | ||
"verify": "Verify", | ||
"login": "Login", | ||
"logout": "Logout", | ||
"signup": "Sign up", | ||
"email_placeholder": "Please enter your email", | ||
"password_placeholder": "Please enter your password", | ||
"unauthorizedTips": "Please sign up or login" | ||
}, | ||
"chat": { | ||
"placeholder": "What would you like to say... (Shift + Enter = newline)", | ||
"placeholderMobile": "What would you like to say...", | ||
"copy": "Copy", | ||
"copied": "Copied", | ||
"copyCode": "Copy code", | ||
"clearChat": "Clear chat session", | ||
"clearChatConfirm": "Do you want to clear the chat session?", | ||
"exportImage": "Export chat session to image", | ||
"exportImageConfirm": "Do you want to save the chat session as an image?", | ||
"exportSuccess": "Saved successfully", | ||
"exportFailed": "Saving failed", | ||
"usingContext": "Context Mode", | ||
"turnOnContext": "In this mode, messages sent will include previous chat logs.", | ||
"turnOffContext": "In this mode, messages sent will not include previous chat logs.", | ||
"deleteMessage": "Delete message", | ||
"deleteMessageConfirm": "Do you want to delete this message?", | ||
"deleteChatSessionsConfirm": "Are you sure you want to delete this record?", | ||
"clearHistoryConfirm": "Are you sure you want to clear the chat history?", | ||
"contextLength": "Context Length, default 10 (2 at the beginning of the conversation + 8 most recent)", | ||
"stopAnswer": "Stop Answering", | ||
"slider": "Context Length", | ||
"temperature": "Temperature", | ||
"maxTokens": "Max Total Tokens", | ||
"topP": "Top P", | ||
"frequencyPenalty": "Frequency Penalty", | ||
"presencePenalty": "Presence Penalty", | ||
"debug": "Debug Mode" | ||
}, | ||
"setting": { | ||
"setting": "Settings", | ||
"general": "Overview", | ||
"config": "Configuration", | ||
"avatarLink": "Avatar Link", | ||
"name": "Name", | ||
"description": "Description", | ||
"resetUserInfo": "Reset User Info", | ||
"chatHistory": "Chat History", | ||
"theme": "Theme", | ||
"language": "Language", | ||
"api": "API", | ||
"reverseProxy": "Reverse Proxy", | ||
"timeout": "Timeout", | ||
"socks": "Socks", | ||
"admin": "Admin" | ||
}, | ||
"admin": { | ||
"title": "Admin", | ||
"permission": "Permission", | ||
"rateLimit": "Rate Limit" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.