-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi-Language Support #165
base: main
Are you sure you want to change the base?
Conversation
There are still some changes that need to be made. Mainly if the preferred language is set to English, it shouldn't translate because the ai responds in English anyways. |
UPDATE:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got some work for ya!
src/agent/commands/actions.js
Outdated
@@ -286,4 +289,38 @@ export const actionsList = [ | |||
return 'Set npc goal: ' + agent.npc.data.curr_goal.name; | |||
} | |||
}, | |||
{ | |||
name: '!setPreferredLanguage', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like writing to the settings file at runtime. This should just change the language for the current session
Ok so a quick update: Most of the changes requested have been done. There is a translator.js file which contains everything needed to translate messages, and it's functions are called from the file where necessary. Currently the only thing that has not returned is the in-game command. This is because I can't find a straightforward way in js to update the variable in translator.js from action in actions.js |
It's been a while but I might take a shot at this again |
Basically the bot can now chat in any language that is on Google Translate.
The "preferred_language" property accepts a language code or name. Since it's using Google Translate names need to be formatted like on Google Translate. For example if you would like to use Chinese, "preferred_language" would have to be set to "Chinese (Simplified)" or "Chinese (Traditional)" (not case sensitive). Anything the user chat's to the bot is automatically translated to English as I didn't want the AI to bug out. The AI response is then translated to the preferred language the user stated. In case the translation fails, it responds in English.
The command !setPreferredLanguage can be used in chat, and it takes one argument which is the language you want to switch to.
Some examples: