mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-22 12:57:03 -04:00
adds ctx translate
This commit is contained in:
parent
064845b307
commit
28af9c5cb5
4 changed files with 129 additions and 88 deletions
|
@ -693,6 +693,27 @@ module.exports.DICTIONARY_LANGUAGES = Object.freeze({
|
|||
zh: "Chinese"
|
||||
})
|
||||
|
||||
// Default list of languages uses in various translate contexts
|
||||
module.exports.TRANSLATE_DEFAULT_LANGUAGE_LIST = Object.freeze([
|
||||
"en",
|
||||
"de",
|
||||
"fr",
|
||||
"es",
|
||||
"pt-PT",
|
||||
"no",
|
||||
"fi",
|
||||
"sv",
|
||||
"it",
|
||||
"ja",
|
||||
"ru",
|
||||
"ar",
|
||||
"he",
|
||||
"tr",
|
||||
"hi",
|
||||
"zh-CN",
|
||||
"zh-TW",
|
||||
])
|
||||
|
||||
// hey if you're looking at this and are annoyed that a language
|
||||
// doesn't as expected work lmk on discord @bignutty and i'll add
|
||||
// it (within reason), same goes for flag emoji below
|
||||
|
@ -1044,6 +1065,7 @@ module.exports.TRANSLATE_LANGUAGE_MAPPINGS = Object.freeze({
|
|||
"pl": "🇵🇱",
|
||||
"pt": "🇵🇹",
|
||||
"pt-pt": "🇵🇹",
|
||||
"pt-PT": "🇵🇹",
|
||||
"pt-br": "🇧🇷",
|
||||
"ro": "🇷🇴",
|
||||
"ru": "🇷🇺",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const { TRANSLATE_LANGUAGES } = require("#constants");
|
||||
const { TRANSLATE_LANGUAGES, TRANSLATE_DEFAULT_LANGUAGE_LIST } = require("#constants");
|
||||
const { getLanguagesFromAny } = require("#utils/translate");
|
||||
|
||||
module.exports = async (context)=>{
|
||||
|
@ -7,25 +7,7 @@ module.exports = async (context)=>{
|
|||
choices = getLanguagesFromAny(context.value)
|
||||
} else {
|
||||
// Default language suggestions
|
||||
choices = [
|
||||
"en",
|
||||
"de",
|
||||
"fr",
|
||||
"es",
|
||||
"pt-PT",
|
||||
"no",
|
||||
"fi",
|
||||
"sv",
|
||||
"it",
|
||||
"ja",
|
||||
"ru",
|
||||
"ar",
|
||||
"he",
|
||||
"tr",
|
||||
"hi",
|
||||
"zh-CN",
|
||||
"zh-TW",
|
||||
]
|
||||
choices = TRANSLATE_DEFAULT_LANGUAGE_LIST
|
||||
}
|
||||
|
||||
return context.respond({ choices: choices.splice(0, 20).map((l)=>({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue