2020-10-20 23:25:34 +02:00
/ * *
2021-07-11 18:51:40 +02:00
* @ name Translator
2021-03-05 13:26:41 +01:00
* @ author DevilBro
2020-10-20 23:25:34 +02:00
* @ authorId 278543574059057154
2023-07-06 08:55:58 +02:00
* @ version 2.5 . 7
2021-07-11 18:51:40 +02:00
* @ description Allows you to translate Messages and your outgoing Messages within Discord
2020-10-20 23:25:34 +02:00
* @ invite Jx3TjNS
2020-11-19 16:45:36 +01:00
* @ donate https : //www.paypal.me/MircoWittrien
* @ patreon https : //www.patreon.com/MircoWittrien
2021-03-09 15:10:55 +01:00
* @ website https : //mwittrien.github.io/
2021-07-11 18:51:40 +02:00
* @ source https : //github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/Translator/
* @ updateUrl https : //mwittrien.github.io/BetterDiscordAddons/Plugins/Translator/Translator.plugin.js
2020-10-20 23:25:34 +02:00
* /
2018-10-11 10:21:26 +02:00
2020-09-19 20:49:33 +02:00
module . exports = ( _ => {
2022-09-01 14:40:11 +02:00
const changeLog = {
2022-10-19 12:51:47 +02:00
2020-02-04 08:20:40 +01:00
} ;
2020-10-31 11:43:29 +01:00
2022-01-30 23:49:21 +01:00
return ! window . BDFDB _Global || ( ! window . BDFDB _Global . loaded && ! window . BDFDB _Global . started ) ? class {
2022-09-01 14:55:22 +02:00
constructor ( meta ) { for ( let key in meta ) this [ key ] = meta [ key ] ; }
getName ( ) { return this . name ; }
getAuthor ( ) { return this . author ; }
getVersion ( ) { return this . version ; }
getDescription ( ) { return ` The Library Plugin needed for ${ this . name } is missing. Open the Plugin Settings to download it. \n \n ${ this . description } ` ; }
2021-02-01 17:13:13 +01:00
downloadLibrary ( ) {
require ( "request" ) . get ( "https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js" , ( e , r , b ) => {
2021-03-05 13:14:18 +01:00
if ( ! e && b && r . statusCode == 200 ) require ( "fs" ) . writeFile ( require ( "path" ) . join ( BdApi . Plugins . folder , "0BDFDB.plugin.js" ) , b , _ => BdApi . showToast ( "Finished downloading BDFDB Library" , { type : "success" } ) ) ;
2021-03-06 14:59:48 +01:00
else BdApi . alert ( "Error" , "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library" ) ;
2021-02-01 17:13:13 +01:00
} ) ;
}
2020-09-19 20:49:33 +02:00
2021-01-06 12:38:36 +01:00
load ( ) {
2020-11-19 16:51:14 +01:00
if ( ! window . BDFDB _Global || ! Array . isArray ( window . BDFDB _Global . pluginQueue ) ) window . BDFDB _Global = Object . assign ( { } , window . BDFDB _Global , { pluginQueue : [ ] } ) ;
2020-09-19 20:49:33 +02:00
if ( ! window . BDFDB _Global . downloadModal ) {
window . BDFDB _Global . downloadModal = true ;
2022-09-01 14:55:22 +02:00
BdApi . showConfirmationModal ( "Library Missing" , ` The Library Plugin needed for ${ this . name } is missing. Please click "Download Now" to install it. ` , {
2020-09-19 20:49:33 +02:00
confirmText : "Download Now" ,
cancelText : "Cancel" ,
onCancel : _ => { delete window . BDFDB _Global . downloadModal ; } ,
2020-09-20 08:15:13 +02:00
onConfirm : _ => {
delete window . BDFDB _Global . downloadModal ;
2021-02-01 17:13:13 +01:00
this . downloadLibrary ( ) ;
2020-09-20 08:15:13 +02:00
}
2020-09-19 20:49:33 +02:00
} ) ;
}
2022-09-01 14:55:22 +02:00
if ( ! window . BDFDB _Global . pluginQueue . includes ( this . name ) ) window . BDFDB _Global . pluginQueue . push ( this . name ) ;
2020-10-09 21:09:35 +02:00
}
2021-01-06 12:38:36 +01:00
start ( ) { this . load ( ) ; }
stop ( ) { }
getSettingsPanel ( ) {
2020-11-28 23:12:09 +01:00
let template = document . createElement ( "template" ) ;
2022-09-01 14:55:22 +02:00
template . innerHTML = ` <div style="color: var(--header-primary); font-size: 16px; font-weight: 300; white-space: pre; line-height: 22px;">The Library Plugin needed for ${ this . name } is missing. \n Please click <a style="font-weight: 500;">Download Now</a> to install it.</div> ` ;
2021-02-01 17:13:13 +01:00
template . content . firstElementChild . querySelector ( "a" ) . addEventListener ( "click" , this . downloadLibrary ) ;
2020-11-28 23:12:09 +01:00
return template . content . firstElementChild ;
}
2020-10-09 21:09:35 +02:00
} : ( ( [ Plugin , BDFDB ] ) => {
2021-03-20 18:50:17 +01:00
var _this ;
2021-01-21 16:15:24 +01:00
const translateIconGeneral = ` <svg name="Translate" width="24" height="24" viewBox="0 0 24 24"><mask/><path fill="currentColor" mask="url(#translateIconMask)" d="M 4 2 C 2.9005593 2 2 2.9005593 2 4 L 2 17 C 2 18.10035 2.9005593 19 4 19 L 11 19 L 12 22 L 20 22 C 21.10035 22 22 21.099441 22 20 L 22 7 C 22 5.9005592 21.099441 5 20 5 L 10.880859 5 L 10 2 L 4 2 z M 11.173828 6 L 20 6 C 20.550175 6 21 6.4498249 21 7 L 21 20 C 21 20.550175 20.550176 21 20 21 L 13 21 L 15 19 L 14.185547 16.236328 L 15.105469 15.314453 L 17.791016 18 L 18.521484 17.269531 L 15.814453 14.583984 C 16.714739 13.54911 17.414914 12.335023 17.730469 11.080078 L 19 11.080078 L 19 10.039062 L 15.365234 10.039062 L 15.365234 9 L 14.324219 9 L 14.324219 10.039062 L 12.365234 10.039062 L 11.173828 6 z M 7.1660156 6.4160156 C 8.2063466 6.4160156 9.1501519 6.7857022 9.9003906 7.4804688 L 9.9648438 7.5449219 L 8.7441406 8.7246094 L 8.6855469 8.6699219 C 8.4009108 8.3998362 7.9053417 8.0859375 7.1660156 8.0859375 C 5.8555986 8.0859375 4.7890625 9.1708897 4.7890625 10.505859 C 4.7890625 11.84083 5.8555986 12.925781 7.1660156 12.925781 C 8.5364516 12.925781 9.1309647 12.050485 9.2910156 11.464844 L 7.0800781 11.464844 L 7.0800781 9.9160156 L 11.03125 9.9160156 L 11.044922 9.984375 C 11.084932 10.194442 11.099609 10.379777 11.099609 10.589844 C 11.094109 12.945139 9.4803883 14.583984 7.1660156 14.583984 C 4.9107525 14.583984 3.0800781 12.749807 3.0800781 10.5 C 3.0800781 8.2501934 4.9162088 6.4160156 7.1660156 6.4160156 z M 12.675781 11.074219 L 16.669922 11.074219 C 16.669922 11.074219 16.330807 12.390095 15.111328 13.810547 C 14.576613 13.195806 14.206233 12.595386 13.970703 12.115234 L 12.980469 12.115234 L 12.675781 11.074219 z M 13.201172 12.884766 C 13.535824 13.484957 13.940482 14.059272 14.390625 14.583984 L 13.855469 15.115234 L 13.201172 12.884766 z"/><extra/></svg> ` ;
const translateIconMask = ` <mask id="translateIconMask" fill="black"><path fill="white" d="M 0 0 H 24 V 24 H 0 Z"/><path fill="black" d="M24 12 H 12 V 24 H 24 Z"/></mask> ` ;
2020-09-19 20:49:33 +02:00
const translateIcon = translateIconGeneral . replace ( ` <extra/> ` , ` ` ) . replace ( ` <mask/> ` , ` ` ) . replace ( ` mask="url(#translateIconMask)" ` , ` ` ) ;
2021-01-21 16:21:08 +01:00
const translateIconUntranslate = translateIconGeneral . replace ( ` <extra/> ` , ` <path fill="none" stroke="#f04747" stroke-width="2" d="m 14.702359,14.702442 8.596228,8.596148 m 0,-8.597139 -8.59722,8.596147 z"/> ` ) . replace ( ` <mask/> ` , translateIconMask ) ;
2021-03-20 18:50:17 +01:00
const TranslateButtonComponent = class TranslateButton extends BdApi . React . Component {
render ( ) {
2021-06-01 16:17:59 +02:00
const enabled = _this . isTranslationEnabled ( this . props . channelId ) ;
2021-03-20 18:50:17 +01:00
return BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . ChannelTextAreaButton , {
2021-07-11 18:51:40 +02:00
className : BDFDB . DOMUtils . formatClassName ( BDFDB . disCN . _translatortranslatebutton , _this . isTranslationEnabled ( this . props . channelId ) && BDFDB . disCN . _translatortranslating , BDFDB . disCN . textareapickerbutton ) ,
2021-03-20 18:50:17 +01:00
isActive : this . props . isActive ,
iconSVG : translateIcon ,
nativeClass : true ,
2021-06-01 16:17:59 +02:00
tooltip : enabled && {
text : ( _ => ` ${ BDFDB . LanguageUtils . getName ( languages [ _this . getLanguageChoice ( languageTypes . INPUT , messageTypes . SENT , this . props . channelId ) ] ) } ➝ ${ BDFDB . LanguageUtils . getName ( languages [ _this . getLanguageChoice ( languageTypes . OUTPUT , messageTypes . SENT , this . props . channelId ) ] ) } ` ) ,
tooltipConfig : { style : "max-width: 400px" }
} ,
2021-03-20 18:50:17 +01:00
onClick : _ => {
this . props . isActive = true ;
BDFDB . ReactUtils . forceUpdate ( this ) ;
BDFDB . ModalUtils . open ( _this , {
2021-05-12 18:41:59 +02:00
size : "LARGE" ,
2021-03-20 18:50:17 +01:00
header : BDFDB . LanguageUtils . LanguageStrings . SETTINGS ,
subHeader : "" ,
onClose : _ => {
this . props . isActive = false ;
BDFDB . ReactUtils . forceUpdate ( this ) ;
} ,
2021-05-25 10:35:29 +02:00
children : BDFDB . ReactUtils . createElement ( TranslateSettingsComponent , {
2022-09-07 13:47:41 +02:00
guildId : this . props . guildId ,
2021-05-25 10:35:29 +02:00
channelId : this . props . channelId
} )
2021-03-20 18:50:17 +01:00
} ) ;
} ,
onContextMenu : _ => {
2021-05-25 10:35:29 +02:00
_this . toggleTranslation ( this . props . channelId ) ;
2021-03-20 18:50:17 +01:00
BDFDB . ReactUtils . forceUpdate ( this ) ;
}
} ) ;
}
} ;
2021-05-12 18:41:59 +02:00
const TranslateSettingsComponent = class TranslateSettings extends BdApi . React . Component {
2021-06-01 16:17:59 +02:00
filterLanguages ( direction , place ) {
let isOutput = direction == languageTypes . OUTPUT ;
2021-05-12 18:41:59 +02:00
return BDFDB . ObjectUtils . toArray ( BDFDB . ObjectUtils . map ( isOutput ? BDFDB . ObjectUtils . filter ( languages , lang => ! lang . auto ) : languages , ( lang , id ) => ( {
value : id ,
2021-06-01 16:17:59 +02:00
label : BDFDB . LanguageUtils . getName ( lang ) ,
2021-05-12 18:41:59 +02:00
backup : this . isOnlyBackup ( lang )
2021-06-01 16:17:59 +02:00
} ) ) ) . filter ( isOutput && this . isOnlyBackup ( languages [ _this . getLanguageChoice ( languageTypes . INPUT , place , this . props . channelId ) ] ) ? ( n => n . backup ) : ( n => n ) ) ;
2021-05-12 18:41:59 +02:00
}
isOnlyBackup ( lang ) {
2021-07-03 11:43:59 +02:00
return lang && ( lang . auto && ! translationEngines [ _this . settings . engines . translator ] . auto || ! lang . auto && ! lang . special && ! translationEngines [ _this . settings . engines . translator ] . languages . includes ( lang . id ) ) ;
2021-05-12 18:41:59 +02:00
}
2021-03-20 18:50:17 +01:00
render ( ) {
2021-05-12 18:41:59 +02:00
return [
BDFDB . ArrayUtils . is ( _this . settings . exceptions . wordStart ) && _this . settings . exceptions . wordStart . length && [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Flex , {
className : BDFDB . disCN . marginbottom8 ,
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SettingsLabel , {
2022-09-07 13:47:41 +02:00
label : _this . labels . exception _text . replace ( "{{var0}}" , _this . settings . exceptions . wordStart . map ( n => '"' + n + '"' ) . join ( ", " ) )
2021-05-12 18:41:59 +02:00
} )
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . FormComponents . FormDivider , {
className : BDFDB . disCN . marginbottom8
2021-03-20 18:50:17 +01:00
} )
2021-05-12 18:41:59 +02:00
] ,
2021-06-01 16:17:59 +02:00
Object . keys ( _this . defaults . choices ) . map ( place => {
2022-09-07 13:47:41 +02:00
let isChannelSpecific = channelLanguages [ this . props . channelId ] && channelLanguages [ this . props . channelId ] [ place ] ;
let isGuildSpecific = ! isChannelSpecific && guildLanguages [ this . props . guildId ] && guildLanguages [ this . props . guildId ] [ place ] ;
2021-06-01 16:17:59 +02:00
return Object . keys ( _this . defaults . choices [ place ] . value ) . map ( direction => [
2021-05-12 18:41:59 +02:00
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . FormComponents . FormItem , {
2022-09-07 13:47:41 +02:00
title : _this . labels [ ` language_choice_ ${ direction . toLowerCase ( ) } _ ${ place . toLowerCase ( ) } ` ] + ": " ,
2021-06-01 16:17:59 +02:00
titleChildren : direction == languageTypes . OUTPUT && [ {
2022-09-07 13:47:41 +02:00
text : _ => isChannelSpecific ? _this . labels . language _selection _channel : isGuildSpecific ? _this . labels . language _selection _server : _this . labels . language _selection _global ,
name : isChannelSpecific || isGuildSpecific ? BDFDB . LibraryComponents . SvgIcon . Names . LOCK _CLOSED : BDFDB . LibraryComponents . SvgIcon . Names . LOCK _OPEN ,
2022-12-12 19:47:37 +01:00
color : isChannelSpecific ? "var(--status-danger)" : isGuildSpecific ? "var(--status-warning)" : null ,
2021-06-01 16:17:59 +02:00
onClick : _ => {
if ( channelLanguages [ this . props . channelId ] && channelLanguages [ this . props . channelId ] [ place ] ) {
2022-09-07 13:47:41 +02:00
isChannelSpecific = false ;
2021-06-01 16:17:59 +02:00
delete channelLanguages [ this . props . channelId ] [ place ] ;
if ( BDFDB . ObjectUtils . isEmpty ( channelLanguages [ this . props . channelId ] ) ) delete channelLanguages [ this . props . channelId ] ;
}
2022-09-07 13:47:41 +02:00
else if ( guildLanguages [ this . props . guildId ] && guildLanguages [ this . props . guildId ] [ place ] ) {
isGuildSpecific = false ;
isChannelSpecific = true ;
delete guildLanguages [ this . props . guildId ] [ place ] ;
if ( BDFDB . ObjectUtils . isEmpty ( guildLanguages [ this . props . guildId ] ) ) delete guildLanguages [ this . props . guildId ] ;
2021-06-01 16:17:59 +02:00
if ( ! channelLanguages [ this . props . channelId ] ) channelLanguages [ this . props . channelId ] = { } ;
channelLanguages [ this . props . channelId ] [ place ] = { } ;
for ( let l in languageTypes ) channelLanguages [ this . props . channelId ] [ place ] [ languageTypes [ l ] ] = _this . getLanguageChoice ( languageTypes [ l ] , place , null ) ;
}
2022-09-07 13:47:41 +02:00
else {
isGuildSpecific = true ;
if ( ! guildLanguages [ this . props . guildId ] ) guildLanguages [ this . props . guildId ] = { } ;
guildLanguages [ this . props . guildId ] [ place ] = { } ;
for ( let l in languageTypes ) guildLanguages [ this . props . guildId ] [ place ] [ languageTypes [ l ] ] = _this . getLanguageChoice ( languageTypes [ l ] , place , null ) ;
}
2021-06-01 16:17:59 +02:00
BDFDB . DataUtils . save ( channelLanguages , _this , "channelLanguages" ) ;
2022-09-07 13:47:41 +02:00
BDFDB . DataUtils . save ( guildLanguages , _this , "guildLanguages" ) ;
2021-06-01 16:17:59 +02:00
BDFDB . ReactUtils . forceUpdate ( this ) ;
}
} , {
iconSVG : ` <svg width="21" height="21" fill="currentColor"><path d="M 0, 10.515 c 0, 2.892, 1.183, 5.521, 3.155, 7.361 L 0, 21.031 h 7.887 V 13.144 l -2.892, 2.892 C 3.549, 14.722, 2.629, 12.75, 2.629, 10.515 c 0 -3.418, 2.235 -6.309, 5.258 -7.492 v -2.629 C 3.418, 1.577, 0, 5.652, 0, 10.515 z M 21.031, 0 H 13.144 v 7.887 l 2.892 -2.892 C 17.482, 6.309, 18.402, 8.281, 18.402, 10.515 c 0, 3.418 -2.235, 6.309 -5.258, 7.492 V 20.768 c 4.469 -1.183, 7.887 -5.258, 7.887 -10.121 c 0 -2.892 -1.183 -5.521 -3.155 -7.361 L 21.031, 0 z"/></svg> ` ,
2021-05-12 18:41:59 +02:00
onClick : _ => {
2021-06-01 16:17:59 +02:00
let input = _this . getLanguageChoice ( languageTypes . INPUT , place , this . props . channelId ) ;
let output = _this . getLanguageChoice ( languageTypes . OUTPUT , place , this . props . channelId ) ;
2021-05-12 18:41:59 +02:00
input = input == "auto" ? "en" : input ;
2021-06-01 16:17:59 +02:00
_this . saveLanguageChoice ( output , languageTypes . INPUT , place , this . props . channelId ) ;
_this . saveLanguageChoice ( input , languageTypes . OUTPUT , place , this . props . channelId ) ;
2021-05-12 18:41:59 +02:00
2021-03-20 18:50:17 +01:00
_this . setLanguages ( ) ;
2021-05-12 18:41:59 +02:00
BDFDB . ReactUtils . forceUpdate ( this ) ;
2021-06-01 16:17:59 +02:00
}
} ] . map ( data => {
const icon = BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Clickable , {
2021-07-11 18:51:40 +02:00
className : BDFDB . disCN . _translatorconfigbutton ,
2021-06-01 16:17:59 +02:00
onClick : data . onClick ,
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SvgIcon , {
width : 24 ,
height : 24 ,
color : data . color || "currentColor" ,
name : data . name ,
iconSVG : data . iconSVG
} )
} ) ;
2022-09-07 13:47:41 +02:00
return data . text ? BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . TooltipContainer , { tooltipConfig : { type : "bottom" } , text : data . text , children : icon } ) : icon ;
2021-06-01 16:17:59 +02:00
} ) ,
2021-05-12 18:41:59 +02:00
className : BDFDB . disCN . marginbottom8 ,
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Select , {
2021-06-01 16:17:59 +02:00
value : _this . getLanguageChoice ( direction , place , this . props . channelId ) ,
options : this . filterLanguages ( direction , place ) ,
2021-05-12 18:41:59 +02:00
optionRenderer : lang => languages [ lang . value ] ? BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Flex , {
align : BDFDB . LibraryComponents . Flex . Align . CENTER ,
children : [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Flex . Child , {
grow : 1 ,
children : lang . label
} ) ,
lang . backup && BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . TooltipContainer , {
2022-09-07 13:47:41 +02:00
text : _this . labels . backup _engine _warning ,
2021-05-12 18:41:59 +02:00
tooltipConfig : {
color : "red"
} ,
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SvgIcon , {
nativeClass : true ,
width : 20 ,
height : 20 ,
2022-12-12 19:47:37 +01:00
color : "var(--status-danger)" ,
2021-05-12 18:41:59 +02:00
name : BDFDB . LibraryComponents . SvgIcon . Names . WARNING
} )
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . FavButton , {
isFavorite : languages [ lang . value ] . fav == 0 ,
onClick : value => {
2021-05-25 10:35:29 +02:00
if ( value ) favorites . push ( lang . value ) ;
else BDFDB . ArrayUtils . remove ( favorites , lang . value , true ) ;
BDFDB . DataUtils . save ( favorites . sort ( ) , _this , "favorites" ) ;
2021-05-12 18:41:59 +02:00
_this . setLanguages ( ) ;
}
} )
]
} ) : null ,
2021-06-06 13:49:58 +02:00
onChange : value => {
_this . saveLanguageChoice ( value , direction , place , this . props . channelId ) ;
BDFDB . ReactUtils . forceUpdate ( this ) ;
}
2021-05-12 18:41:59 +02:00
} )
} ) ,
2021-06-01 16:17:59 +02:00
direction == languageTypes . OUTPUT && BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . FormComponents . FormDivider , {
2021-05-12 18:41:59 +02:00
className : BDFDB . disCN . marginbottom8
} )
2021-06-01 16:17:59 +02:00
] ) ;
2021-05-12 18:41:59 +02:00
} ) ,
Object . keys ( _this . defaults . engines ) . map ( key => BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . FormComponents . FormItem , {
2022-09-07 13:47:41 +02:00
title : _this . labels [ ` ${ key } _engine ` ] ,
2021-05-12 18:41:59 +02:00
className : BDFDB . disCN . marginbottom8 ,
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Select , {
value : _this . settings . engines [ key ] ,
options : ( key == "backup" ? [ "----" ] : [ ] ) . concat ( Object . keys ( translationEngines ) ) . filter ( key == "backup" ? ( n => n != _this . settings . engines . translator ) : ( n => n ) ) . map ( engineKey => ( { value : engineKey , label : translationEngines [ engineKey ] ? translationEngines [ engineKey ] . name : "----" } ) ) ,
maxVisibleItems : 3 ,
onChange : value => {
_this . settings . engines [ key ] = value ;
BDFDB . DataUtils . save ( _this . settings . engines , _this , "engines" ) ;
_this . setLanguages ( ) ;
BDFDB . ReactUtils . forceUpdate ( this ) ;
}
} )
} ) ) ,
2021-06-01 16:17:59 +02:00
Object . keys ( _this . defaults . general ) . filter ( key => _this . defaults . general [ key ] . popout ) . map ( key => BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SettingsSaveItem , {
2021-05-12 18:41:59 +02:00
type : "Switch" ,
plugin : _this ,
2021-06-01 16:17:59 +02:00
keys : [ "general" , key ] ,
2022-09-07 13:47:41 +02:00
label : _this . labels [ ` general_ ${ key } ` ] ,
2022-11-22 01:30:30 +01:00
tag : BDFDB . LibraryComponents . FormComponents . FormTags . H5 ,
2021-06-01 16:17:59 +02:00
value : _this . settings . general [ key ]
} ) ) ,
2021-05-12 18:41:59 +02:00
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SettingsItem , {
type : "Switch" ,
2022-09-07 13:47:41 +02:00
label : _this . labels . translate _your _message ,
2022-11-22 01:30:30 +01:00
tag : BDFDB . LibraryComponents . FormComponents . FormTags . H5 ,
2021-05-25 10:35:29 +02:00
value : _this . isTranslationEnabled ( this . props . channelId ) ,
2021-03-20 18:50:17 +01:00
onChange : value => {
2021-05-25 10:35:29 +02:00
_this . toggleTranslation ( this . props . channelId ) ;
2021-05-12 18:41:59 +02:00
BDFDB . ReactUtils . forceUpdate ( this ) ;
2021-03-20 18:50:17 +01:00
}
} )
2021-05-12 18:41:59 +02:00
] . flat ( 10 ) . filter ( n => n ) ;
2021-03-20 18:50:17 +01:00
}
} ;
2019-01-26 22:45:19 +01:00
2020-09-19 20:49:33 +02:00
const brailleConverter = {
"0" : "⠴" , "1" : "⠂" , "2" : "⠆" , "3" : "⠒" , "4" : "⠲" , "5" : "⠢" , "6" : "⠖" , "7" : "⠶" , "8" : "⠦" , "9" : "⠔" , "!" : "⠮" , "\"" : "⠐" , "#" : "⠼" , "$" : "⠫" , "%" : "⠩" , "&" : "⠯" , "'" : "⠄" , "(" : "⠷" , ")" : "⠾" , "*" : "⠡" , "+" : "⠬" , "," : "⠠" , "-" : "⠤" , "." : "⠨" , "/" : "⠌" , ":" : "⠱" , ";" : "⠰" , "<" : "⠣" , "=" : "⠿" , ">" : "⠜" , "?" : "⠹" , "@" : "⠈" , "a" : "⠁" , "b" : "⠃" , "c" : "⠉" , "d" : "⠙" , "e" : "⠑" , "f" : "⠋" , "g" : "⠛" , "h" : "⠓" , "i" : "⠊" , "j" : "⠚" , "k" : "⠅" , "l" : "⠇" , "m" : "⠍" , "n" : "⠝" , "o" : "⠕" , "p" : "⠏" , "q" : "⠟" , "r" : "⠗" , "s" : "⠎" , "t" : "⠞" , "u" : "⠥" , "v" : "⠧" , "w" : "⠺" , "x" : "⠭" , "y" : "⠽" , "z" : "⠵" , "[" : "⠪" , "\\" : "⠳" , "]" : "⠻" , "^" : "⠘" , "⠁" : "a" , "⠂" : "1" , "⠃" : "b" , "⠄" : "'" , "⠅" : "k" , "⠆" : "2" , "⠇" : "l" , "⠈" : "@" , "⠉" : "c" , "⠊" : "i" , "⠋" : "f" , "⠌" : "/" , "⠍" : "m" , "⠎" : "s" , "⠏" : "p" , "⠐" : "\"" , "⠑" : "e" , "⠒" : "3" , "⠓" : "h" , "⠔" : "9" , "⠕" : "o" , "⠖" : "6" , "⠗" : "r" , "⠘" : "^" , "⠙" : "d" , "⠚" : "j" , "⠛" : "g" , "⠜" : ">" , "⠝" : "n" , "⠞" : "t" , "⠟" : "q" , "⠠" : ", " , "⠡" : "*" , "⠢" : "5" , "⠣" : "<" , "⠤" : "-" , "⠥" : "u" , "⠦" : "8" , "⠧" : "v" , "⠨" : "." , "⠩" : "%" , "⠪" : "[" , "⠫" : "$" , "⠬" : "+" , "⠭" : "x" , "⠮" : "!" , "⠯" : "&" , "⠰" : ";" , "⠱" : ":" , "⠲" : "4" , "⠳" : "\\" , "⠴" : "0" , "⠵" : "z" , "⠶" : "7" , "⠷" : "(" , "⠸" : "_" , "⠹" : "?" , "⠺" : "w" , "⠻" : "]" , "⠼" : "#" , "⠽" : "y" , "⠾" : ")" , "⠿" : "=" , "_" : "⠸"
} ;
2019-01-26 22:45:19 +01:00
2020-09-19 20:49:33 +02:00
const morseConverter = {
"0" : "− − − − − " , "1" : "·−−−−" , "2" : "··−−−" , "3" : "···−−" , "4" : "····−" , "5" : "·····" , "6" : "−····" , "7" : "−−···" , "8" : "−−−··" , "9" : "−−−−·" , "!" : "−·−·−−" , "\"" : "·−··−·" , "$" : "···−··−" , "&" : "·−···" , "'" : "·−−−−·" , "(" : "−·−−·" , ")" : "−·−−·−" , "+" : "·−·−·" , "," : "−−··−−" , "-" : "−····−" , "." : "·−·−·−" , "/" : "−··−·" , ":" : "−−−···" , ";" : "−·−·−·" , "=" : "−···−" , "?" : "··−−··" , "@" : "·−−·−·" , "a" : "·−" , "b" : "−···" , "c" : "−·−·" , "d" : "−··" , "e" : "·" , "f" : "··−·" , "g" : "−−·" , "h" : "····" , "i" : "··" , "j" : "·−−−" , "k" : "−·−" , "l" : "·−··" , "m" : "− − " , "n" : "−·" , "o" : "− − − " , "p" : "·−−·" , "q" : "−−·−" , "r" : "·−·" , "s" : "···" , "t" : "− " , "u" : "··−" , "v" : "···−" , "w" : "·−−" , "x" : "−··−" , "y" : "−·−−" , "z" : "−−··" , "·" : "e" , "··" : "i" , "···" : "s" , "····" : "h" , "·····" : "5" , "····−" : "4" , "···−" : "v" , "···−··−" : "$" , "···−−" : "3" , "··−" : "u" , "··−·" : "f" , "··−−··" : "?" , "··−−·−" : "_" , "··−−−" : "2" , "·−" : "a" , "·−·" : "r" , "·−··" : "l" , "·−···" : "&" , "·−··−·" : "\"" , "·−·−·" : "+" , "·−·−·−" : "." , "·−−" : "w" , "·−−·" : "p" , "·−−·−·" : "@" , "·−−−" : "j" , "·−−−−" : "1" , "·−−−−·" : "'" , "− " : "t" , "−·" : "n" , "−··" : "d" , "−···" : "b" , "−····" : "6" , "−····−" : "-" , "−···−" : "=" , "−··−" : "x" , "−··−·" : "/" , "−·−" : "k" , "−·−·" : "c" , "−·−·−·" : ";" , "−·−·−−" : "!" , "−·−−" : "y" , "−·−−·" : "(" , "−·−−·−" : ")" , "− − " : "m" , "−−·" : "g" , "−−··" : "z" , "−−···" : "7" , "−−··−−" : "," , "−−·−" : "q" , "− − − " : "o" , "−−−··" : "8" , "−−−···" : ":" , "−−−−·" : "9" , "− − − − − " : "0" , "_" : "··−−·−"
} ;
2021-08-10 15:47:10 +02:00
const googleLanguages = [ "af" , "am" , "ar" , "az" , "be" , "bg" , "bn" , "bs" , "ca" , "ceb" , "co" , "cs" , "cy" , "da" , "de" , "el" , "en" , "eo" , "es" , "et" , "eu" , "fa" , "fi" , "fr" , "fy" , "ga" , "gd" , "gl" , "gu" , "ha" , "haw" , "hi" , "hmn" , "hr" , "ht" , "hu" , "hy" , "id" , "ig" , "is" , "it" , "iw" , "ja" , "jw" , "ka" , "kk" , "km" , "kn" , "ko" , "ku" , "ky" , "la" , "lb" , "lo" , "lt" , "lv" , "mg" , "mi" , "mk" , "ml" , "mn" , "mr" , "ms" , "mt" , "my" , "ne" , "nl" , "no" , "ny" , "or" , "pa" , "pl" , "ps" , "pt" , "ro" , "ru" , "rw" , "sd" , "si" , "sk" , "sl" , "sm" , "sn" , "so" , "sq" , "sr" , "st" , "su" , "sv" , "sw" , "ta" , "te" , "tg" , "th" , "tk" , "tl" , "tr" , "tt" , "ug" , "uk" , "ur" , "uz" , "vi" , "xh" , "yi" , "yo" , "zh-CN" , "zh-TW" , "zu" ] ;
2020-09-19 20:49:33 +02:00
const translationEngines = {
2021-06-06 13:49:58 +02:00
googleapi : {
name : "Google" ,
auto : true ,
funcName : "googleApiTranslate" ,
languages : googleLanguages
} ,
deepl : {
name : "DeepL" ,
auto : true ,
funcName : "deepLTranslate" ,
2023-04-14 18:05:29 +02:00
languages : [ "bg" , "cs" , "da" , "de" , "en" , "el" , "es" , "et" , "fi" , "fr" , "hu" , "id" , "it" , "ja" , "ko" , "lt" , "lv" , "nl" , "no" , "pl" , "pt" , "ro" , "ru" , "sk" , "sl" , "sv" , "tr" , "uk" , "zh" ] ,
2021-10-14 16:51:23 +02:00
premium : true ,
2021-06-06 13:49:58 +02:00
key : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:fx"
} ,
itranslate : {
name : "iTranslate" ,
auto : true ,
funcName : "iTranslateTranslate" ,
languages : [ ... new Set ( [ "af" , "ar" , "az" , "be" , "bg" , "bn" , "bs" , "ca" , "ceb" , "cs" , "cy" , "da" , "de" , "el" , "en" , "eo" , "es" , "et" , "eu" , "fa" , "fi" , "fil" , "fr" , "ga" , "gl" , "gu" , "ha" , "he" , "hi" , "hmn" , "hr" , "ht" , "hu" , "hy" , "id" , "ig" , "is" , "it" , "ja" , "jw" , "ka" , "kk" , "km" , "kn" , "ko" , "la" , "lo" , "lt" , "lv" , "mg" , "mi" , "mk" , "ml" , "mn" , "mr" , "ms" , "mt" , "my" , "ne" , "nl" , "no" , "ny" , "pa" , "pl" , "pt-BR" , "pt-PT" , "ro" , "ru" , "si" , "sk" , "sl" , "so" , "sq" , "sr" , "st" , "su" , "sv" , "sw" , "ta" , "te" , "tg" , "th" , "tr" , "uk" , "ur" , "uz" , "vi" , "we" , "yi" , "yo" , "zh-CN" , "zh-TW" , "zu" ] . concat ( googleLanguages ) ) ] . sort ( ) ,
key : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
} ,
yandex : {
name : "Yandex" ,
auto : true ,
funcName : "yandexTranslate" ,
languages : [ "af" , "am" , "ar" , "az" , "ba" , "be" , "bg" , "bn" , "bs" , "ca" , "ceb" , "cs" , "cy" , "da" , "de" , "el" , "en" , "eo" , "es" , "et" , "eu" , "fa" , "fi" , "fr" , "ga" , "gd" , "gl" , "gu" , "he" , "hi" , "hr" , "ht" , "hu" , "hy" , "id" , "is" , "it" , "ja" , "jv" , "ka" , "kk" , "km" , "kn" , "ko" , "ky" , "la" , "lb" , "lo" , "lt" , "lv" , "mg" , "mhr" , "mi" , "mk" , "ml" , "mn" , "mr" , "ms" , "mt" , "my" , "ne" , "nl" , "no" , "pa" , "pap" , "pl" , "pt" , "ro" , "ru" , "si" , "sk" , "sl" , "sq" , "sr" , "su" , "sv" , "sw" , "ta" , "te" , "tg" , "th" , "tl" , "tr" , "tt" , "udm" , "uk" , "ur" , "uz" , "vi" , "xh" , "yi" , "zh" ] ,
key : "trnsl.x.x.xxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
} ,
papago : {
name : "Papago" ,
auto : false ,
funcName : "papagoTranslate" ,
languages : [ "en" , "es" , "fr" , "id" , "ja" , "ko" , "th" , "vi" , "zh-CN" , "zh-TW" ] ,
key : "xxxxxxxxxxxxxxxxxxxx xxxxxxxxxx"
2021-08-05 14:06:44 +02:00
} ,
baidu : {
name : "Baidu" ,
auto : true ,
funcName : "baiduTranslate" ,
2023-07-06 08:55:58 +02:00
languages : [ "ar" , "bg" , "cs" , "da" , "de" , "el" , "en" , "es" , "et" , "fi" , "fr" , "hu" , "it" , "ja" , "ko" , "nl" , "pl" , "pt" , "ro" , "ru" , "sl" , "sv" , "th" , "vi" , "zh" , "zh-CN" , "zh-TW" ] ,
2021-08-05 14:06:44 +02:00
parser : {
"ar" : "ara" ,
"bg" : "bul" ,
"da" : "dan" ,
"es" : "spa" ,
"et" : "est" ,
"fi" : "fin" ,
"fr" : "fra" ,
2023-07-06 08:55:58 +02:00
"ja" : "jp" ,
2021-08-05 14:06:44 +02:00
"ko" : "kor" ,
"ro" : "rom" ,
"sl" : "slo" ,
"sv" : "swe" ,
"vi" : "vie" ,
2022-03-10 17:38:07 +01:00
"zh" : "wyw" ,
"zh-CN" : "zh" ,
2021-08-05 14:06:44 +02:00
"zh-TW" : "cht"
} ,
2023-03-22 07:28:29 +01:00
key : "xxxxxxxxxx xxxxxxxxxxxxxxxxxxxx"
2021-06-06 13:49:58 +02:00
}
2020-09-19 20:49:33 +02:00
} ;
2021-05-25 10:35:29 +02:00
var languages = { } ;
var favorites = [ ] ;
2021-06-06 13:49:58 +02:00
var authKeys = { } ;
2022-09-07 13:47:41 +02:00
var channelLanguages = { } , guildLanguages = { } ;
2021-05-25 10:35:29 +02:00
var translationEnabledStates = [ ] , isTranslating ;
var translatedMessages = { } , oldMessages = { } ;
2021-06-01 16:17:59 +02:00
const defaultLanguages = {
INPUT : "auto" ,
OUTPUT : "$discord"
} ;
const languageTypes = {
INPUT : "input" ,
OUTPUT : "output"
} ;
const messageTypes = {
RECEIVED : "received" ,
SENT : "sent" ,
} ;
2020-09-19 20:49:33 +02:00
2021-07-11 18:51:40 +02:00
return class Translator extends Plugin {
2021-01-06 12:38:36 +01:00
onLoad ( ) {
2021-03-20 18:50:17 +01:00
_this = this ;
2020-09-19 20:49:33 +02:00
this . defaults = {
2021-03-20 18:50:17 +01:00
general : {
2022-09-07 13:47:41 +02:00
addTranslateButton : { value : true , popout : false } ,
usePerChatTranslation : { value : true , popout : false } ,
sendOriginalMessage : { value : false , popout : true } ,
showOriginalMessage : { value : false , popout : true }
2020-09-19 20:49:33 +02:00
} ,
2021-06-01 16:17:59 +02:00
choices : { } ,
2020-10-31 11:43:29 +01:00
exceptions : {
2022-09-07 13:47:41 +02:00
wordStart : { value : [ "!" ] , max : 1 }
2020-10-31 11:43:29 +01:00
} ,
2020-09-19 20:49:33 +02:00
engines : {
2022-09-07 13:47:41 +02:00
translator : { value : "googleapi" } ,
backup : { value : "----" }
2020-09-19 20:49:33 +02:00
}
} ;
2021-06-01 16:17:59 +02:00
for ( let m in messageTypes ) this . defaults . choices [ messageTypes [ m ] ] = { value : Object . keys ( languageTypes ) . reduce ( ( newObj , l ) => ( newObj [ languageTypes [ l ] ] = defaultLanguages [ l ] , newObj ) , { } ) } ;
2020-02-04 08:20:40 +01:00
2022-10-19 12:51:47 +02:00
this . modulePatches = {
before : [
"ChannelTextAreaContainer" ,
"ChannelTextAreaEditor" ,
"Embed" ,
"MessageReply" ,
"Messages"
] ,
after : [
"ChannelTextAreaButtons" ,
"Embed" ,
2022-10-19 13:02:23 +02:00
"MessageActionsContextMenu" ,
"MessageContent" ,
"MessageToolbar"
2022-10-19 12:51:47 +02:00
]
2020-09-19 20:49:33 +02:00
} ;
2020-02-04 08:20:40 +01:00
2020-09-19 20:49:33 +02:00
this . css = `
2021-07-11 18:51:40 +02:00
$ { BDFDB . dotCN . _translatortranslatebutton + BDFDB . dotCNS . _translatortranslating + BDFDB . dotCN . textareaicon } {
2022-12-11 17:44:31 +01:00
color : var ( -- status - danger ) ! important ;
2020-09-19 20:49:33 +02:00
}
2021-07-11 18:51:40 +02:00
$ { BDFDB . dotCN . _translatorconfigbutton } {
2021-06-01 16:26:43 +02:00
margin : 2 px 3 px 0 6 px ;
}
2020-09-19 20:49:33 +02:00
` ;
2020-02-04 08:20:40 +01:00
}
2020-09-19 20:49:33 +02:00
2021-01-06 12:38:36 +01:00
onStart ( ) {
2022-11-06 12:22:44 +01:00
BDFDB . PatchUtils . patch ( this , BDFDB . LibraryModules . MessageUtils , "startEditMessage" , { before : e => {
if ( e . methodArguments [ 1 ] && oldMessages [ e . methodArguments [ 1 ] ] && oldMessages [ e . methodArguments [ 1 ] ] . content ) e . methodArguments [ 2 ] = oldMessages [ e . methodArguments [ 1 ] ] . content ;
} } ) ;
BDFDB . PatchUtils . patch ( this , BDFDB . LibraryModules . MessageUtils , "editMessage" , { before : e => {
delete translatedMessages [ e . methodArguments [ 1 ] ] ;
delete oldMessages [ e . methodArguments [ 1 ] ] ;
} } ) ;
2020-06-09 09:52:52 +02:00
this . forceUpdateAll ( ) ;
2020-02-04 08:20:40 +01:00
}
2020-09-19 20:49:33 +02:00
2021-01-06 12:38:36 +01:00
onStop ( ) {
2020-06-09 09:52:52 +02:00
this . forceUpdateAll ( ) ;
2020-02-04 08:20:40 +01:00
}
2019-01-26 22:45:19 +01:00
2020-09-19 20:49:33 +02:00
getSettingsPanel ( collapseStates = { } ) {
2021-03-20 19:04:57 +01:00
let settingsPanel ;
return settingsPanel = BDFDB . PluginUtils . createSettingsPanel ( this , {
collapseStates : collapseStates ,
children : _ => {
let settingsItems = [ ] ;
for ( let key in this . defaults . general ) settingsItems . push ( BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SettingsSaveItem , {
type : "Switch" ,
plugin : this ,
keys : [ "general" , key ] ,
2022-09-07 13:47:41 +02:00
label : this . labels [ ` general_ ${ key } ` ] ,
2021-03-20 19:04:57 +01:00
value : this . settings . general [ key ]
} ) ) ;
settingsItems . push ( BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . FormComponents . FormDivider , {
className : BDFDB . disCNS . dividerdefault + BDFDB . disCN . marginbottom8
} ) ) ;
2021-06-06 13:49:58 +02:00
settingsItems . push ( BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SettingsPanelList , {
title : "Own Auth Keys:" ,
2021-10-14 16:51:23 +02:00
children : Object . keys ( translationEngines ) . filter ( key => translationEngines [ key ] . key ) . map ( key => BDFDB . ReactUtils . createElement ( "div" , {
className : BDFDB . disCN . marginbottom8 ,
children : [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Flex , {
className : BDFDB . disCN . marginbottom8 ,
align : BDFDB . LibraryComponents . Flex . Align . CENTER ,
direction : BDFDB . LibraryComponents . Flex . Direction . HORIZONTAL ,
children : [
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . FormComponents . FormTitle , {
className : BDFDB . disCN . marginreset ,
2022-11-22 01:30:30 +01:00
tag : BDFDB . LibraryComponents . FormComponents . FormTags . H5 ,
2021-10-14 16:51:23 +02:00
children : translationEngines [ key ] . name
} ) ,
translationEngines [ key ] . premium && BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SettingsItem , {
type : "Switch" ,
margin : 0 ,
grow : 0 ,
label : "Paid Version" ,
2022-11-22 01:30:30 +01:00
tag : BDFDB . LibraryComponents . FormComponents . FormTags . H5 ,
2021-10-14 16:51:23 +02:00
value : authKeys [ key ] && authKeys [ key ] . paid ,
onChange : value => {
if ( ! authKeys [ key ] ) authKeys [ key ] = { } ;
authKeys [ key ] . paid = value ;
BDFDB . DataUtils . save ( authKeys , this , "authKeys" ) ;
}
} )
]
} ) ,
BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . TextInput , {
placeholder : translationEngines [ key ] . key ,
value : authKeys [ key ] && authKeys [ key ] . key ,
onChange : value => {
if ( ! authKeys [ key ] ) authKeys [ key ] = { } ;
authKeys [ key ] . key = ( value || "" ) . trim ( ) ;
BDFDB . DataUtils . save ( authKeys , this , "authKeys" ) ;
}
} )
]
2021-06-06 13:49:58 +02:00
} ) )
} ) ) ;
settingsItems . push ( BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . FormComponents . FormDivider , {
className : BDFDB . disCNS . dividerdefault + BDFDB . disCN . marginbottom8
} ) ) ;
2021-03-20 19:04:57 +01:00
for ( let key in this . defaults . exceptions ) settingsItems . push ( BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . FormComponents . FormItem , {
2022-09-23 13:51:55 +02:00
title : this . labels . exception _text . replace ( "{{var0}}" , "" ) . split ( " " ) . filter ( n => n ) . join ( " " ) ,
2021-03-20 19:04:57 +01:00
className : BDFDB . disCN . marginbottom8 ,
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . ListInput , {
placeholder : "New Exception" ,
maxLength : this . defaults . exceptions [ key ] . max ,
items : this . settings . exceptions [ key ] ,
onChange : value => {
this . SettingsUpdated = true ;
BDFDB . DataUtils . save ( value , this , "exceptions" , key ) ;
}
} )
} ) ) ;
return settingsItems . flat ( 10 ) ;
}
} ) ;
2020-09-19 20:49:33 +02:00
}
2020-02-04 08:20:40 +01:00
2021-01-06 12:38:36 +01:00
onSettingsClosed ( ) {
2020-09-19 20:49:33 +02:00
if ( this . SettingsUpdated ) {
delete this . SettingsUpdated ;
this . forceUpdateAll ( ) ;
}
}
2021-01-06 12:38:36 +01:00
forceUpdateAll ( ) {
2020-09-19 20:49:33 +02:00
favorites = BDFDB . DataUtils . load ( this , "favorites" ) ;
2021-05-25 10:35:29 +02:00
favorites = ! BDFDB . ArrayUtils . is ( favorites ) ? [ ] : favorites ;
2020-09-19 20:49:33 +02:00
2021-06-06 13:49:58 +02:00
authKeys = BDFDB . DataUtils . load ( this , "authKeys" ) ;
2021-06-01 16:17:59 +02:00
channelLanguages = BDFDB . DataUtils . load ( this , "channelLanguages" ) ;
2022-09-07 13:47:41 +02:00
guildLanguages = BDFDB . DataUtils . load ( this , "guildLanguages" ) ;
translationEnabledStates = BDFDB . DataUtils . load ( this , "translationEnabledStates" ) ;
translationEnabledStates = BDFDB . ArrayUtils . is ( translationEnabledStates ) ? translationEnabledStates : [ ] ;
2021-06-01 16:17:59 +02:00
2020-09-19 20:49:33 +02:00
this . setLanguages ( ) ;
BDFDB . PatchUtils . forceAllUpdates ( this ) ;
BDFDB . MessageUtils . rerenderAll ( ) ;
2020-02-04 08:20:40 +01:00
}
2019-01-26 22:45:19 +01:00
2020-09-19 20:49:33 +02:00
onMessageContextMenu ( e ) {
if ( e . instance . props . message && e . instance . props . channel ) {
2022-11-06 12:22:44 +01:00
let translated = ! ! translatedMessages [ e . instance . props . message . id ] ;
2020-09-19 20:49:33 +02:00
let hint = BDFDB . BDUtils . isPluginEnabled ( "MessageUtilities" ) ? BDFDB . BDUtils . getPlugin ( "MessageUtilities" ) . getActiveShortcutString ( "__Translate_Message" ) : null ;
let [ children , index ] = BDFDB . ContextMenuUtils . findItem ( e . returnvalue , { id : [ "pin" , "unpin" ] } ) ;
if ( index == - 1 ) [ children , index ] = BDFDB . ContextMenuUtils . findItem ( e . returnvalue , { id : [ "edit" , "add-reaction" , "quote" ] } ) ;
children . splice ( index > - 1 ? index + 1 : 0 , 0 , BDFDB . ContextMenuUtils . createItem ( BDFDB . LibraryComponents . MenuItems . MenuItem , {
2020-12-21 19:56:36 +01:00
label : translated ? this . labels . context _messageuntranslateoption : this . labels . context _messagetranslateoption ,
2020-09-19 20:49:33 +02:00
id : BDFDB . ContextMenuUtils . createItemId ( this . name , translated ? "untranslate-message" : "translate-message" ) ,
2022-02-25 16:12:53 +01:00
hint : hint && ( _ => BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . MenuItems . MenuHint , {
hint : hint
} ) ) ,
icon : _ => BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . MenuItems . MenuIcon , {
icon : translated ? translateIconUntranslate : translateIcon
2020-09-19 20:49:33 +02:00
} ) ,
disabled : ! translated && isTranslating ,
2021-05-18 20:09:05 +02:00
action : _ => this . translateMessage ( e . instance . props . message , e . instance . props . channel )
2020-09-19 20:49:33 +02:00
} ) ) ;
2023-06-20 09:36:21 +02:00
this . injectSearchItem ( e , false ) ;
2020-09-19 20:49:33 +02:00
}
}
2022-10-19 13:02:23 +02:00
onTextAreaContextMenu ( e ) {
2023-06-20 09:36:21 +02:00
this . injectSearchItem ( e , true ) ;
2020-09-19 20:49:33 +02:00
}
2023-06-20 09:36:21 +02:00
injectSearchItem ( e , ownMessage ) {
2020-09-19 20:49:33 +02:00
let text = document . getSelection ( ) . toString ( ) ;
if ( text ) {
let translating , foundTranslation , foundInput , foundOutput ;
let [ children , index ] = BDFDB . ContextMenuUtils . findItem ( e . returnvalue , { id : [ "devmode-copy-id" , "search-google" ] , group : true } ) ;
children . splice ( index > - 1 ? index + 1 : 0 , 0 , BDFDB . ContextMenuUtils . createItem ( BDFDB . LibraryComponents . MenuItems . MenuGroup , {
children : BDFDB . ContextMenuUtils . createItem ( BDFDB . LibraryComponents . MenuItems . MenuItem , {
id : BDFDB . ContextMenuUtils . createItemId ( this . name , "search-translation" ) ,
2022-10-19 13:02:23 +02:00
icon : _ => BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . MenuItems . MenuIcon , {
icon : translateIcon
} ) ,
2020-09-19 20:49:33 +02:00
disabled : isTranslating ,
2021-07-11 18:51:40 +02:00
label : this . labels . context _translator ,
2020-09-19 20:49:33 +02:00
persisting : true ,
action : event => {
let item = BDFDB . DOMUtils . getParent ( BDFDB . dotCN . menuitem , event . target ) ;
if ( item ) {
let createTooltip = _ => {
2022-10-19 13:02:23 +02:00
BDFDB . TooltipUtils . create ( item , ! foundTranslation ? this . labels . toast _translating _failed : [
2021-06-01 16:17:59 +02:00
` ${ BDFDB . LanguageUtils . LibraryStrings . from } ${ foundInput . name } : ` ,
text ,
` ${ BDFDB . LanguageUtils . LibraryStrings . to } ${ foundOutput . name } : ` ,
foundTranslation
] . map ( n => BDFDB . ReactUtils . createElement ( "div" , { children : n } ) ) , {
2021-01-12 19:09:01 +01:00
type : "right" ,
2022-10-19 13:02:23 +02:00
color : foundTranslation ? "black" : "red" ,
2021-01-12 19:09:01 +01:00
className : "googletranslate-tooltip"
} ) ;
2020-09-19 20:49:33 +02:00
} ;
if ( foundTranslation && foundInput && foundOutput ) {
if ( document . querySelector ( ".googletranslate-tooltip" ) ) {
BDFDB . ContextMenuUtils . close ( e . instance ) ;
2021-01-10 11:41:01 +01:00
BDFDB . DiscordUtils . openLink ( this . getGoogleTranslatePageURL ( foundInput . id , foundOutput . id , text ) ) ;
2020-05-23 14:50:13 +02:00
}
2020-09-19 20:49:33 +02:00
else createTooltip ( ) ;
}
else if ( ! translating ) {
translating = true ;
2023-06-20 09:36:21 +02:00
this . translateText ( text , ownMessage ? messageTypes . SENT : messageTypes . RECEIVED , ( translation , input , output ) => {
2020-09-19 20:49:33 +02:00
if ( translation ) {
foundTranslation = translation , foundInput = input , foundOutput = output ;
createTooltip ( ) ;
}
2022-10-19 13:02:23 +02:00
else createTooltip ( ) ;
2020-09-19 20:49:33 +02:00
} ) ;
}
2020-05-23 14:50:13 +02:00
}
2019-12-09 15:56:53 +01:00
}
2020-09-19 20:49:33 +02:00
} )
} ) ) ;
}
}
2022-10-19 13:02:23 +02:00
processMessageActionsContextMenu ( e ) {
2020-09-19 20:49:33 +02:00
if ( e . instance . props . message && e . instance . props . channel ) {
let translated = ! ! translatedMessages [ e . instance . props . message . id ] ;
let [ children , index ] = BDFDB . ContextMenuUtils . findItem ( e . returnvalue , { id : [ "pin" , "unpin" ] } ) ;
children . splice ( index + 1 , 0 , BDFDB . ContextMenuUtils . createItem ( BDFDB . LibraryComponents . MenuItems . MenuItem , {
2020-12-21 19:56:36 +01:00
label : translated ? this . labels . context _messageuntranslateoption : this . labels . context _messagetranslateoption ,
2020-09-19 20:49:33 +02:00
disabled : isTranslating ,
id : BDFDB . ContextMenuUtils . createItemId ( this . name , translated ? "untranslate-message" : "translate-message" ) ,
2022-02-25 16:12:53 +01:00
icon : _ => BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . MenuItems . MenuIcon , {
icon : translated ? translateIconUntranslate : translateIcon
} ) ,
2021-05-18 20:09:05 +02:00
action : _ => this . translateMessage ( e . instance . props . message , e . instance . props . channel )
2020-09-19 20:49:33 +02:00
} ) ) ;
}
2020-02-04 08:20:40 +01:00
}
2020-09-23 09:29:56 +02:00
2022-10-19 13:02:23 +02:00
processMessageToolbar ( e ) {
2023-02-03 21:18:05 +01:00
if ( ! e . instance . props . message || ! e . instance . props . channel ) return ;
let expanded = ! BDFDB . LibraryStores . AccessibilityStore . keyboardModeEnabled && ! e . instance . props . showEmojiPicker && ! e . instance . props . showEmojiBurstPicker && ! e . instance . props . showMoreUtilities && BDFDB . ListenerUtils . isPressed ( 16 ) ;
if ( ! expanded ) return ;
let translated = ! ! translatedMessages [ e . instance . props . message . id ] ;
e . returnvalue . props . children . unshift ( ) ;
e . returnvalue . props . children . unshift ( BDFDB . ReactUtils . createElement ( class extends BdApi . React . Component {
render ( ) {
return BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . TooltipContainer , {
key : translated ? "untranslate-message" : "translate-message" ,
text : _ => translated ? _this . labels . context _messageuntranslateoption : _this . labels . context _messagetranslateoption ,
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . Clickable , {
className : BDFDB . disCN . messagetoolbarbutton ,
onClick : _ => {
if ( ! isTranslating ) _this . translateMessage ( e . instance . props . message , e . instance . props . channel ) . then ( _ => {
translated = ! ! translatedMessages [ e . instance . props . message . id ] ;
BDFDB . ReactUtils . forceUpdate ( this ) ;
} ) ;
} ,
children : BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . SvgIcon , {
className : BDFDB . disCN . messagetoolbaricon ,
iconSVG : translated ? translateIconUntranslate : translateIcon
2021-05-18 20:09:05 +02:00
} )
2023-02-03 21:18:05 +01:00
} )
} ) ;
}
} ) ) ;
2020-09-23 09:29:56 +02:00
}
2020-09-19 20:49:33 +02:00
2022-10-19 12:51:47 +02:00
processChannelTextAreaContainer ( e ) {
2022-10-31 21:10:36 +01:00
if ( e . instance . props . type != BDFDB . DiscordConstants . ChannelTextAreaTypes . NORMAL && e . instance . props . type != BDFDB . DiscordConstants . ChannelTextAreaTypes . NORMAL _WITH _ACTIVITY && e . instance . props . type != BDFDB . DiscordConstants . ChannelTextAreaTypes . SIDEBAR ) return ;
2022-10-19 12:51:47 +02:00
BDFDB . PatchUtils . patch ( this , e . instance . props , "onSubmit" , { instead : e2 => {
2022-04-10 10:18:04 +02:00
if ( this . isTranslationEnabled ( e . instance . props . channel . id ) && e2 . methodArguments [ 0 ] . value ) {
e2 . stopOriginalMethodCall ( ) ;
this . translateText ( e2 . methodArguments [ 0 ] . value , messageTypes . SENT , ( translation , input , output ) => {
translation = ! translation ? e2 . methodArguments [ 0 ] . value : ( this . settings . general . sendOriginalMessage ? ( translation + "\n\n> *" + e2 . methodArguments [ 0 ] . value . split ( "\n" ) . join ( "*\n> *" ) + "*" ) : translation ) ;
e2 . originalMethod ( Object . assign ( { } , e2 . methodArguments [ 0 ] , { value : translation } ) ) ;
} ) ;
return Promise . resolve ( {
shouldClear : true ,
shouldRefocus : true
} ) ;
2020-02-04 08:20:40 +01:00
}
2022-04-09 10:03:37 +02:00
return e2 . callOriginalMethodAfterwards ( ) ;
2022-10-25 17:22:33 +02:00
} } , { noCache : true } ) ;
2020-02-04 08:20:40 +01:00
}
2022-10-19 12:51:47 +02:00
processChannelTextAreaEditor ( e ) {
2021-05-25 10:35:29 +02:00
if ( this . isTranslationEnabled ( e . instance . props . channel . id ) && isTranslating ) e . instance . props . disabled = true ;
2020-09-19 20:49:33 +02:00
}
2022-01-30 23:49:21 +01:00
processChannelTextAreaButtons ( e ) {
2022-10-31 21:10:36 +01:00
if ( ! this . settings . general . addTranslateButton || e . instance . props . disabled || e . instance . props . type != BDFDB . DiscordConstants . ChannelTextAreaTypes . NORMAL && e . instance . props . type != BDFDB . DiscordConstants . ChannelTextAreaTypes . NORMAL _WITH _ACTIVITY && e . instance . props . type != BDFDB . DiscordConstants . ChannelTextAreaTypes . SIDEBAR ) return ;
2023-04-14 18:05:29 +02:00
if ( e . returnvalue ) e . returnvalue . props . children . unshift ( BDFDB . ReactUtils . createElement ( TranslateButtonComponent , {
2022-10-31 21:10:36 +01:00
guildId : e . instance . props . channel . guild _id ? e . instance . props . channel . guild _id : "@me" ,
channelId : e . instance . props . channel . id
} ) ) ;
2019-12-21 02:24:30 +01:00
}
2019-01-26 22:45:19 +01:00
2020-09-19 20:49:33 +02:00
processMessages ( e ) {
2022-10-19 12:51:47 +02:00
e . instance . props . channelStream = [ ] . concat ( e . instance . props . channelStream ) ;
for ( let i in e . instance . props . channelStream ) {
let message = e . instance . props . channelStream [ i ] . content ;
2020-09-19 20:49:33 +02:00
if ( message ) {
2022-10-19 12:51:47 +02:00
if ( BDFDB . ArrayUtils . is ( message . attachments ) ) this . checkMessage ( e . instance . props . channelStream [ i ] , message ) ;
2020-09-19 20:49:33 +02:00
else if ( BDFDB . ArrayUtils . is ( message ) ) for ( let j in message ) {
let childMessage = message [ j ] . content ;
if ( childMessage && BDFDB . ArrayUtils . is ( childMessage . attachments ) ) this . checkMessage ( message [ j ] , childMessage ) ;
}
2020-05-15 09:58:08 +02:00
}
}
}
2020-09-19 20:49:33 +02:00
checkMessage ( stream , message ) {
let translation = translatedMessages [ message . id ] ;
if ( translation ) stream . content . content = translation . content ;
else if ( oldMessages [ message . id ] && Object . keys ( message ) . some ( key => ! BDFDB . equals ( oldMessages [ message . id ] [ key ] , message [ key ] ) ) ) {
stream . content . content = oldMessages [ message . id ] . content ;
delete oldMessages [ message . id ] ;
}
2020-05-23 14:50:13 +02:00
}
2019-12-21 11:25:13 +01:00
2022-06-17 19:18:58 +02:00
processMessageReply ( e ) {
2022-11-02 15:43:09 +01:00
if ( ! e . instance . props . referencedMessage || ! e . instance . props . referencedMessage . message || ! translatedMessages [ e . instance . props . referencedMessage . message . id ] ) return ;
2022-10-19 12:51:47 +02:00
e . instance . props . referencedMessage = Object . assign ( { } , e . instance . props . referencedMessage ) ;
e . instance . props . referencedMessage . message = new BDFDB . DiscordObjects . Message ( e . instance . props . referencedMessage . message ) ;
e . instance . props . referencedMessage . message . content = translatedMessages [ e . instance . props . referencedMessage . message . id ] . content ;
2022-06-17 19:18:58 +02:00
}
2020-09-19 20:49:33 +02:00
processMessageContent ( e ) {
2022-10-19 12:51:47 +02:00
if ( ! e . instance . props . message ) return ;
let translation = translatedMessages [ e . instance . props . message . id ] ;
if ( translation && translation . content ) e . returnvalue . props . children . push ( BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . TooltipContainer , {
text : ` ${ BDFDB . LanguageUtils . getName ( translation . input ) } ➝ ${ BDFDB . LanguageUtils . LibraryStrings . to } ${ BDFDB . LanguageUtils . getName ( translation . output ) } ` ,
tooltipConfig : { style : "max-width: 400px" } ,
children : BDFDB . ReactUtils . createElement ( "span" , {
className : BDFDB . DOMUtils . formatClassName ( BDFDB . disCN . messagetimestamp , BDFDB . disCN . messagetimestampinline , BDFDB . disCN . _translatortranslated ) ,
2021-05-03 20:30:07 +02:00
children : BDFDB . ReactUtils . createElement ( "span" , {
2022-10-19 12:51:47 +02:00
className : BDFDB . disCN . messageedited ,
children : ` ( ${ this . labels . translated _watermark } ) `
2020-09-19 20:49:33 +02:00
} )
2022-10-19 12:51:47 +02:00
} )
} ) ) ;
2020-02-04 08:20:40 +01:00
}
2020-09-19 20:49:33 +02:00
processEmbed ( e ) {
2022-10-19 12:51:47 +02:00
if ( ! e . instance . props . embed || ! e . instance . props . embed . message _id ) return ;
let translation = translatedMessages [ e . instance . props . embed . message _id ] ;
if ( translation && Object . keys ( translation . embeds ) . length ) {
if ( ! e . returnvalue ) e . instance . props . embed = Object . assign ( { } , e . instance . props . embed , {
rawDescription : translation . embeds [ e . instance . props . embed . id ] ,
originalDescription : e . instance . props . embed . originalDescription || e . instance . props . embed . rawDescription
} ) ;
else {
let [ children , index ] = BDFDB . ReactUtils . findParent ( e . returnvalue , { props : [ [ "className" , BDFDB . disCN . embeddescription ] ] } ) ;
if ( index > - 1 ) children [ index ] . props . children . push ( BDFDB . ReactUtils . createElement ( BDFDB . LibraryComponents . TooltipContainer , {
text : ` ${ BDFDB . LanguageUtils . getName ( translation . input ) } ➝ ${ BDFDB . LanguageUtils . getName ( translation . output ) } ` ,
tooltipConfig : { style : "max-width: 400px" } ,
children : BDFDB . ReactUtils . createElement ( "span" , {
className : BDFDB . DOMUtils . formatClassName ( BDFDB . disCN . messagetimestamp , BDFDB . disCN . messagetimestampinline , BDFDB . disCN . _translatortranslated ) ,
2021-05-03 20:30:07 +02:00
children : BDFDB . ReactUtils . createElement ( "span" , {
2022-10-19 12:51:47 +02:00
className : BDFDB . disCN . messageedited ,
children : ` ( ${ this . labels . translated _watermark } ) `
2020-09-19 20:49:33 +02:00
} )
2022-10-19 12:51:47 +02:00
} )
} ) ) ;
2020-02-04 08:20:40 +01:00
}
2019-10-24 21:30:55 +02:00
}
2022-10-19 12:51:47 +02:00
else if ( ! e . returnvalue && e . instance . props . embed . originalDescription ) {
e . instance . props . embed = Object . assign ( { } , e . instance . props . embed , { rawDescription : e . instance . props . embed . originalDescription } ) ;
delete e . instance . props . embed . originalDescription ;
}
2020-02-04 08:20:40 +01:00
}
2021-05-25 10:35:29 +02:00
toggleTranslation ( channelId ) {
if ( ! this . isTranslationEnabled ( channelId ) ) translationEnabledStates . push ( this . settings . general . usePerChatTranslation ? channelId : "global" ) ;
else BDFDB . ArrayUtils . remove ( translationEnabledStates , this . settings . general . usePerChatTranslation ? channelId : "global" , true ) ;
2022-09-07 13:47:41 +02:00
BDFDB . DataUtils . save ( translationEnabledStates , this , "translationEnabledStates" ) ;
2021-05-25 10:35:29 +02:00
}
isTranslationEnabled ( channelId ) {
return translationEnabledStates . includes ( this . settings . general . usePerChatTranslation ? channelId : "global" ) ;
}
2019-10-24 11:47:57 +02:00
2021-01-06 12:38:36 +01:00
setLanguages ( ) {
2021-05-12 18:41:59 +02:00
if ( this . settings . engines . translator == this . settings . engines . backup ) {
this . settings . engines . backup = Object . keys ( translationEngines ) . filter ( n => n != this . settings . engines . translator ) [ 0 ] ;
BDFDB . DataUtils . save ( this . settings . engines , this , "engines" ) ;
}
2021-05-15 20:55:12 +02:00
let engine = translationEngines [ this . settings . engines . translator ] || { } ;
let backup = translationEngines [ this . settings . engines . backup ] || { } ;
let languageIds = [ ] . concat ( engine . languages , backup . languages ) . flat ( 10 ) . filter ( n => n ) ;
2020-09-19 20:49:33 +02:00
languages = BDFDB . ObjectUtils . deepAssign (
2021-05-15 20:55:12 +02:00
! engine . auto && ! backup . auto ? { } : {
2020-09-19 20:49:33 +02:00
auto : {
2021-05-12 18:41:59 +02:00
auto : true ,
2022-09-07 13:47:41 +02:00
name : this . labels . detect _language ,
2020-09-19 20:49:33 +02:00
id : "auto"
}
2020-06-05 20:03:21 +02:00
} ,
2020-09-19 20:49:33 +02:00
BDFDB . ObjectUtils . filter ( BDFDB . LanguageUtils . languages , lang => languageIds . includes ( lang . id ) ) ,
{
binary : {
2021-05-12 18:41:59 +02:00
special : true ,
2020-09-19 20:49:33 +02:00
name : "Binary" ,
id : "binary"
} ,
braille : {
2021-05-12 18:41:59 +02:00
special : true ,
2020-09-19 20:49:33 +02:00
name : "Braille 6-dot" ,
id : "braille"
} ,
morse : {
2021-05-12 18:41:59 +02:00
special : true ,
2020-09-19 20:49:33 +02:00
name : "Morse" ,
id : "morse"
}
2020-06-05 20:03:21 +02:00
}
2020-09-19 20:49:33 +02:00
) ;
2021-05-25 10:35:29 +02:00
for ( let id in languages ) languages [ id ] . fav = favorites . includes ( id ) ? 0 : 1 ;
2020-09-19 20:49:33 +02:00
languages = BDFDB . ObjectUtils . sort ( languages , "fav" ) ;
}
2019-01-26 22:45:19 +01:00
2021-06-01 16:17:59 +02:00
getLanguageChoice ( direction , place , channelId ) {
2020-09-19 20:49:33 +02:00
this . setLanguages ( ) ;
2021-06-01 16:17:59 +02:00
let choice ;
2022-09-27 14:48:10 +02:00
let channel = channelId && BDFDB . LibraryStores . ChannelStore . getChannel ( channelId ) ;
2022-09-07 13:47:41 +02:00
let guildId = channel ? ( channel . guild _id ? channel . guild _id : "@me" ) : null ;
2021-06-01 16:17:59 +02:00
if ( channelLanguages [ channelId ] && channelLanguages [ channelId ] [ place ] ) choice = channelLanguages [ channelId ] [ place ] [ direction ] ;
2022-09-07 13:47:41 +02:00
else if ( guildId && guildLanguages [ guildId ] && guildLanguages [ guildId ] [ place ] ) choice = guildLanguages [ guildId ] [ place ] [ direction ] ;
2021-06-01 16:17:59 +02:00
else choice = this . settings . choices [ place ] && this . settings . choices [ place ] [ direction ] ;
2020-09-19 20:49:33 +02:00
choice = languages [ choice ] ? choice : Object . keys ( languages ) [ 0 ] ;
2021-06-01 16:17:59 +02:00
choice = direction == languageTypes . OUTPUT && choice == "auto" ? "en" : choice ;
2020-09-19 20:49:33 +02:00
return choice ;
2019-09-27 09:48:32 +02:00
}
2020-09-19 20:49:33 +02:00
2021-06-01 16:17:59 +02:00
saveLanguageChoice ( choice , direction , place , channelId ) {
2022-09-27 14:48:10 +02:00
let channel = channelId && BDFDB . LibraryStores . ChannelStore . getChannel ( channelId ) ;
2022-09-07 13:47:41 +02:00
let guildId = channel ? ( channel . guild _id ? channel . guild _id : "@me" ) : null ;
2021-06-01 16:17:59 +02:00
if ( channelLanguages [ channelId ] && channelLanguages [ channelId ] [ place ] ) {
channelLanguages [ channelId ] [ place ] [ direction ] = choice ;
BDFDB . DataUtils . save ( channelLanguages , this , "channelLanguages" ) ;
}
2022-09-07 13:47:41 +02:00
else if ( guildLanguages [ guildId ] && guildLanguages [ guildId ] [ place ] ) {
guildLanguages [ guildId ] [ place ] [ direction ] = choice ;
BDFDB . DataUtils . save ( guildLanguages , this , "guildLanguages" ) ;
}
2021-06-01 16:17:59 +02:00
else {
this . settings . choices [ place ] [ direction ] = choice ;
BDFDB . DataUtils . save ( this . settings . choices , this , "choices" ) ;
}
}
2020-09-19 20:49:33 +02:00
translateMessage ( message , channel ) {
2021-05-18 20:09:05 +02:00
return new Promise ( callback => {
if ( ! message ) return callback ( null ) ;
if ( translatedMessages [ message . id ] ) {
delete translatedMessages [ message . id ] ;
BDFDB . MessageUtils . rerenderAll ( true ) ;
callback ( false ) ;
}
else {
2021-06-01 16:17:59 +02:00
let orignalContent = message . content || "" ;
for ( let embed of message . embeds ) orignalContent += ( "\n__________________ __________________ __________________\n" + embed . rawDescription ) ;
this . translateText ( orignalContent , messageTypes . RECEIVED , ( translation , input , output ) => {
2021-05-18 20:09:05 +02:00
if ( translation ) {
oldMessages [ message . id ] = new BDFDB . DiscordObjects . Message ( message ) ;
2021-06-01 16:17:59 +02:00
let oldStrings = orignalContent . split ( /\n{0,1}__________________ __________________ __________________\n{0,1}/ ) ;
2021-05-18 20:09:05 +02:00
let strings = translation . split ( /\n{0,1}__________________ __________________ __________________\n{0,1}/ ) ;
2021-06-01 16:17:59 +02:00
let oldContent = this . settings . general . showOriginalMessage && ( oldStrings . shift ( ) || "" ) . trim ( ) ;
let content = ( strings . shift ( ) || "" ) . trim ( ) + ( oldContent ? ` \n \n ${ oldContent } ` : "" ) ;
let embeds = { } ;
2021-05-18 20:09:05 +02:00
for ( let i in message . embeds ) {
message . embeds [ i ] . message _id = message . id ;
2021-06-01 16:17:59 +02:00
let oldEmbedString = this . settings . general . showOriginalMessage && ( oldStrings . shift ( ) || "" ) . trim ( ) ;
embeds [ message . embeds [ i ] . id ] = ( strings . shift ( ) || message . embeds [ i ] . rawDescription ) . trim ( ) + ( oldEmbedString ? ` \n \n ${ oldEmbedString } ` : "" ) ;
2021-05-18 20:09:05 +02:00
}
translatedMessages [ message . id ] = { content , embeds , input , output } ;
BDFDB . MessageUtils . rerenderAll ( true ) ;
2020-09-19 20:49:33 +02:00
}
2021-05-18 20:09:05 +02:00
callback ( true ) ;
} ) ;
}
} ) ;
2019-12-09 15:56:53 +01:00
}
2019-01-26 22:45:19 +01:00
2021-06-01 16:17:59 +02:00
translateText ( text , place , callback ) {
2021-05-12 18:41:59 +02:00
let toast = null , toastInterval , finished = false , finishTranslation = translation => {
2020-09-19 20:49:33 +02:00
isTranslating = false ;
2021-01-26 21:14:48 +01:00
if ( toast ) toast . close ( ) ;
2021-05-12 18:41:59 +02:00
if ( finished ) return ;
finished = true ;
if ( translation ) translation = this . addExceptions ( translation , excepts ) ;
2020-09-19 20:49:33 +02:00
callback ( translation == text ? "" : translation , input , output ) ;
} ;
2021-06-01 16:17:59 +02:00
let [ newText , excepts , translate ] = this . removeExceptions ( text . trim ( ) , place ) ;
2022-09-27 20:19:49 +02:00
let channelId = BDFDB . LibraryStores . SelectedChannelStore . getChannelId ( ) ;
2021-06-01 16:17:59 +02:00
let input = Object . assign ( { } , languages [ this . getLanguageChoice ( languageTypes . INPUT , place , channelId ) ] ) ;
let output = Object . assign ( { } , languages [ this . getLanguageChoice ( languageTypes . OUTPUT , place , channelId ) ] ) ;
2020-12-14 10:43:32 +01:00
if ( translate && input . id != output . id ) {
let specialCase = this . checkForSpecialCase ( newText , input ) ;
if ( specialCase ) {
input . name = specialCase . name ;
switch ( specialCase . id ) {
2020-10-31 11:43:29 +01:00
case "binary" : newText = this . binary2string ( newText ) ; break ;
case "braille" : newText = this . braille2string ( newText ) ; break ;
case "morse" : newText = this . morse2string ( newText ) ; break ;
2020-09-19 20:49:33 +02:00
}
2020-02-04 08:20:40 +01:00
}
2021-05-12 18:41:59 +02:00
if ( output . special ) {
2020-09-19 20:49:33 +02:00
switch ( output . id ) {
2020-10-31 11:43:29 +01:00
case "binary" : newText = this . string2binary ( newText ) ; break ;
case "braille" : newText = this . string2braille ( newText ) ; break ;
case "morse" : newText = this . string2morse ( newText ) ; break ;
2020-09-19 20:49:33 +02:00
}
2020-10-31 11:43:29 +01:00
finishTranslation ( newText ) ;
2020-02-04 08:20:40 +01:00
}
2020-09-19 20:49:33 +02:00
else {
2021-05-12 18:41:59 +02:00
const startTranslating = engine => {
2020-09-19 20:49:33 +02:00
isTranslating = true ;
2021-05-12 18:41:59 +02:00
if ( toast ) toast . close ( ) ;
BDFDB . TimeUtils . clear ( toastInterval ) ;
2022-04-29 14:52:56 +02:00
toast = BDFDB . NotificationUtils . toast ( ` ${ this . labels . toast _translating } ( ${ translationEngines [ engine ] . name } ) - ${ BDFDB . LanguageUtils . LibraryStrings . please _wait } ` , {
2021-05-12 18:41:59 +02:00
timeout : 0 ,
2022-04-29 14:52:56 +02:00
ellipsis : true ,
2021-05-12 18:41:59 +02:00
position : "center" ,
onClose : _ => BDFDB . TimeUtils . clear ( toastInterval )
} ) ;
toastInterval = BDFDB . TimeUtils . interval ( ( _ , count ) => {
2022-04-29 14:52:56 +02:00
if ( count < 40 ) return ;
finishTranslation ( "" ) ;
BDFDB . NotificationUtils . toast ( ` ${ this . labels . toast _translating _failed } ( ${ translationEngines [ engine ] . name } ) - ${ this . labels . toast _translating _tryanother } ` , {
type : "danger" ,
position : "center"
} ) ;
2021-05-12 18:41:59 +02:00
} , 500 ) ;
} ;
if ( this . validTranslator ( this . settings . engines . translator , input , output , specialCase ) ) {
startTranslating ( this . settings . engines . translator ) ;
this [ translationEngines [ this . settings . engines . translator ] . funcName ] . apply ( this , [ { input , output , text : newText , specialCase , engine : translationEngines [ this . settings . engines . translator ] } , translation => {
if ( ! translation && this . validTranslator ( this . settings . engines . backup , input , output , specialCase ) ) {
startTranslating ( this . settings . engines . backup ) ;
this [ translationEngines [ this . settings . engines . backup ] . funcName ] . apply ( this , [ { input , output , text : newText , specialCase , engine : translationEngines [ this . settings . engines . backup ] } , finishTranslation ] ) ;
}
else finishTranslation ( translation ) ;
} ] ) ;
}
else if ( this . validTranslator ( this . settings . engines . backup , input , output , specialCase ) ) {
startTranslating ( this . settings . engines . backup ) ;
this [ translationEngines [ this . settings . engines . backup ] . funcName ] . apply ( this , [ { input , output , text : newText , specialCase , engine : translationEngines [ this . settings . engines . backup ] } , finishTranslation ] ) ;
}
2021-05-18 20:09:05 +02:00
else finishTranslation ( ) ;
2020-02-04 08:20:40 +01:00
}
2019-12-09 15:56:53 +01:00
}
2020-09-19 20:49:33 +02:00
else finishTranslation ( ) ;
2018-10-11 10:21:26 +02:00
}
2020-09-19 20:49:33 +02:00
2021-05-12 18:41:59 +02:00
validTranslator ( key , input , output , specialCase ) {
return translationEngines [ key ] && typeof this [ translationEngines [ key ] . funcName ] == "function" && ( specialCase || input . auto && translationEngines [ key ] . auto || translationEngines [ key ] . languages . includes ( input . id ) && translationEngines [ key ] . languages . includes ( output . id ) ) ;
}
2021-05-12 14:33:47 +02:00
googleApiTranslate ( data , callback ) {
BDFDB . LibraryRequires . request ( ` https://translate.googleapis.com/translate_a/single?client=gtx&sl= ${ data . input . id } &tl= ${ data . output . id } &dt=t&dj=1&source=input&q= ${ encodeURIComponent ( data . text ) } ` , ( error , response , body ) => {
if ( ! error && body && response . statusCode == 200 ) {
try {
body = JSON . parse ( body ) ;
if ( ! data . specialCase && body . src && body . src && languages [ body . src ] ) {
data . input . name = languages [ body . src ] . name ;
data . input . ownlang = languages [ body . src ] . ownlang ;
}
callback ( body . sentences . map ( n => n && n . trans ) . filter ( n => n ) . join ( "" ) ) ;
}
catch ( err ) { callback ( "" ) ; }
2020-02-28 15:01:54 +01:00
}
2021-05-12 14:33:47 +02:00
else {
2022-09-07 13:47:41 +02:00
if ( response . statusCode == 429 ) BDFDB . NotificationUtils . toast ( ` ${ this . labels . toast _translating _failed } . ${ this . labels . toast _translating _tryanother } . ${ this . labels . error _hourlylimit } ` , {
2021-05-12 14:33:47 +02:00
type : "danger" ,
position : "center"
} ) ;
2022-09-07 13:47:41 +02:00
else BDFDB . NotificationUtils . toast ( ` ${ this . labels . toast _translating _failed } . ${ this . labels . toast _translating _tryanother } . ${ this . labels . error _serverdown } ` , {
2021-05-12 14:33:47 +02:00
type : "danger" ,
position : "center"
} ) ;
callback ( "" ) ;
2020-09-19 20:49:33 +02:00
}
} ) ;
}
2021-05-12 14:33:47 +02:00
deepLTranslate ( data , callback ) {
2021-10-14 16:51:23 +02:00
BDFDB . LibraryRequires . request ( ` ${ authKeys . deepl && authKeys . deepl . paid ? "https://api.deepl.com/v2/translate" : "https://api-free.deepl.com/v2/translate" } ?auth_key= ${ authKeys . deepl && authKeys . deepl . key || "75cc2f40-fdae-14cd-7242-6a384e2abb9c:fx" } &text= ${ encodeURIComponent ( data . text ) } ${ data . input . auto ? "" : ` &source_lang= ${ data . input . id } ` } &target_lang= ${ data . output . id } ` , ( error , response , body ) => {
2021-05-12 14:33:47 +02:00
if ( ! error && body && response . statusCode == 200 ) {
2020-02-04 08:20:40 +01:00
try {
2021-05-12 14:33:47 +02:00
body = JSON . parse ( body ) ;
if ( ! data . specialCase && body . translations [ 0 ] && body . translations [ 0 ] . detected _source _language && languages [ body . translations [ 0 ] . detected _source _language . toLowerCase ( ) ] ) {
data . input . name = languages [ body . translations [ 0 ] . detected _source _language . toLowerCase ( ) ] . name ;
data . input . ownlang = languages [ body . translations [ 0 ] . detected _source _language . toLowerCase ( ) ] . ownlang ;
2020-02-04 08:20:40 +01:00
}
2021-05-12 14:33:47 +02:00
callback ( body . translations . map ( n => n && n . text ) . filter ( n => n ) . join ( "" ) ) ;
2020-02-04 08:20:40 +01:00
}
catch ( err ) { callback ( "" ) ; }
}
else {
2022-09-07 13:47:41 +02:00
if ( response . statusCode == 429 || response . statusCode == 456 ) BDFDB . NotificationUtils . toast ( ` ${ this . labels . toast _translating _failed } . ${ this . labels . toast _translating _tryanother } . ${ this . labels . error _dailylimit } ` , {
2021-05-12 14:33:47 +02:00
type : "danger" ,
position : "center"
} ) ;
2022-09-07 13:47:41 +02:00
else if ( response . statusCode == 403 ) BDFDB . NotificationUtils . toast ( ` ${ this . labels . toast _translating _failed } . ${ this . labels . toast _translating _tryanother } . ${ this . labels . error _keyoutdated } ` , {
2021-01-26 21:14:48 +01:00
type : "danger" ,
2021-01-28 14:11:00 +01:00
position : "center"
2021-01-26 21:14:48 +01:00
} ) ;
2022-09-07 13:47:41 +02:00
else BDFDB . NotificationUtils . toast ( ` ${ this . labels . toast _translating _failed } . ${ this . labels . toast _translating _tryanother } . ${ this . labels . error _serverdown } ` , {
2021-01-26 21:14:48 +01:00
type : "danger" ,
2021-01-28 14:11:00 +01:00
position : "center"
2021-01-26 21:14:48 +01:00
} ) ;
2020-02-04 08:20:40 +01:00
callback ( "" ) ;
}
} ) ;
2020-09-19 20:49:33 +02:00
}
iTranslateTranslate ( data , callback ) {
let translate = _ => {
2022-11-02 12:40:53 +01:00
BDFDB . LibraryRequires . request ( "https://web-api.itranslateapp.com/v3/texts/translate" , {
method : "post" ,
2020-09-19 20:49:33 +02:00
headers : {
2021-10-14 16:51:23 +02:00
"API-KEY" : authKeys . itranslate && authKeys . itranslate . key || data . engine . APIkey
2020-09-19 20:49:33 +02:00
} ,
body : JSON . stringify ( {
source : {
dialect : data . input . id ,
text : data . text
} ,
target : {
dialect : data . output . id
}
} )
2021-05-12 14:33:47 +02:00
} , ( error , response , body ) => {
2020-09-19 20:49:33 +02:00
if ( ! error && response && response . statusCode == 200 ) {
try {
2021-05-12 14:33:47 +02:00
body = JSON . parse ( body ) ;
if ( ! data . specialCase && body . source && body . source . dialect && languages [ body . source . dialect ] ) {
data . input . name = languages [ body . source . dialect ] . name ;
data . input . ownlang = languages [ body . source . dialect ] . ownlang ;
2020-09-19 20:49:33 +02:00
}
2021-05-12 14:33:47 +02:00
callback ( body . target . text ) ;
2020-09-19 20:49:33 +02:00
}
catch ( err ) { callback ( "" ) ; }
}
else {
2022-09-07 13:47:41 +02:00
if ( response . statusCode == 429 ) BDFDB . NotificationUtils . toast ( ` ${ this . labels . toast _translating _failed } . ${ this . labels . toast _translating _tryanother } . ${ this . labels . error _dailylimit } ` , {
2021-05-12 14:33:47 +02:00
type : "danger" ,
position : "center"
} ) ;
2022-09-07 13:47:41 +02:00
else if ( response . statusCode == 403 ) BDFDB . NotificationUtils . toast ( ` ${ this . labels . toast _translating _failed } . ${ this . labels . toast _translating _tryanother } . ${ this . labels . error _keyoutdated } ` , {
2021-05-12 14:33:47 +02:00
type : "danger" ,
position : "center"
} ) ;
2022-09-07 13:47:41 +02:00
else BDFDB . NotificationUtils . toast ( ` ${ this . labels . toast _translating _failed } . ${ this . labels . toast _translating _tryanother } . ${ this . labels . error _serverdown } ` , {
2021-01-26 21:14:48 +01:00
type : "danger" ,
2021-01-28 14:11:00 +01:00
position : "center"
2021-01-26 21:14:48 +01:00
} ) ;
2020-09-19 20:49:33 +02:00
callback ( "" ) ;
}
} ) ;
} ;
2021-10-14 16:51:23 +02:00
if ( authKeys . itranslate && authKeys . itranslate . key || data . engine . APIkey ) translate ( ) ;
2021-05-12 14:33:47 +02:00
else BDFDB . LibraryRequires . request ( "https://www.itranslate.com/js/webapp/main.js" , { gzip : true } , ( error , response , body ) => {
if ( ! error && body ) {
let APIkey = /var API_KEY = "(.+)"/ . exec ( body ) ;
2020-09-19 20:49:33 +02:00
if ( APIkey ) {
data . engine . APIkey = APIkey [ 1 ] ;
translate ( ) ;
2019-12-10 13:21:59 +01:00
}
2020-09-19 20:49:33 +02:00
else callback ( "" ) ;
2019-12-10 13:21:59 +01:00
}
2020-02-04 08:20:40 +01:00
else callback ( "" ) ;
2020-09-19 20:49:33 +02:00
} ) ;
}
yandexTranslate ( data , callback ) {
2021-10-14 16:51:23 +02:00
BDFDB . LibraryRequires . request ( ` https://translate.yandex.net/api/v1.5/tr/translate?key= ${ authKeys . yandex && authKeys . yandex . key || "trnsl.1.1.20191206T223907Z.52bd512eca953a5b.1ec123ce4dcab3ae859f312d27cdc8609ab280de" } &text= ${ encodeURIComponent ( data . text ) } &lang= ${ data . specialCase || data . input . auto ? data . output . id : ( data . input . id + "-" + data . output . id ) } &options=1 ` , ( error , response , body ) => {
2021-05-12 14:33:47 +02:00
if ( ! error && body && response . statusCode == 200 ) {
2021-08-05 14:06:44 +02:00
try {
body = BDFDB . DOMUtils . create ( body ) ;
let translation = body . querySelector ( "text" ) ;
let detected = body . querySelector ( "detected" ) ;
if ( translation && detected ) {
let detectedLang = detected . getAttribute ( "lang" ) ;
if ( ! data . specialCase && detectedLang && languages [ detectedLang ] ) {
data . input . name = languages [ detectedLang ] . name ;
data . input . ownlang = languages [ detectedLang ] . ownlang ;
}
callback ( translation . innerText ) ;
2020-09-19 20:49:33 +02:00
}
2021-08-05 14:06:44 +02:00
else callback ( "" ) ;
2020-09-19 20:49:33 +02:00
}
2021-08-05 14:06:44 +02:00
catch ( err ) { callback ( "" ) ; }
2020-12-14 10:43:32 +01:00
}
2021-08-05 14:06:44 +02:00
else if ( body && body . indexOf ( 'code="408"' ) > - 1 ) {
2022-09-07 13:47:41 +02:00
BDFDB . NotificationUtils . toast ( ` ${ this . labels . toast _translating _failed } . ${ this . labels . toast _translating _tryanother } . ${ this . labels . error _monthlylimit } ` , {
2021-01-26 21:14:48 +01:00
type : "danger" ,
2021-01-28 14:11:00 +01:00
position : "center"
2021-01-26 21:14:48 +01:00
} ) ;
2020-12-14 10:43:32 +01:00
callback ( "" ) ;
2020-06-26 22:42:48 +02:00
}
2020-09-19 20:49:33 +02:00
else {
2022-09-07 13:47:41 +02:00
BDFDB . NotificationUtils . toast ( ` ${ this . labels . toast _translating _failed } . ${ this . labels . toast _translating _tryanother } . ${ this . labels . error _serverdown } / ${ this . labels . error _keyoutdated } ` , {
2021-01-26 21:14:48 +01:00
type : "danger" ,
2021-01-28 14:11:00 +01:00
position : "center"
2021-01-26 21:14:48 +01:00
} ) ;
2020-09-19 20:49:33 +02:00
callback ( "" ) ;
}
} ) ;
}
papagoTranslate ( data , callback ) {
2023-04-14 19:02:10 +02:00
const credentials = ( authKeys . papago && authKeys . papago . key || "kUNGxtAmTJQFbaFehdjk zC70k3VhpM" ) . split ( " " ) ;
2022-11-23 23:24:53 +01:00
BDFDB . LibraryRequires . request ( "https://openapi.naver.com/v1/papago/n2mt" , {
method : "post" ,
2020-09-19 20:49:33 +02:00
form : {
source : data . input . id ,
target : data . output . id ,
text : data . text
} ,
headers : {
2021-06-06 13:49:58 +02:00
"X-Naver-Client-Id" : credentials [ 0 ] ,
"X-Naver-Client-Secret" : credentials [ 1 ]
2020-09-19 20:49:33 +02:00
}
2021-05-12 14:33:47 +02:00
} , ( error , response , body ) => {
if ( ! error && body && response . statusCode == 200 ) {
2020-09-19 20:49:33 +02:00
try {
2021-05-12 14:33:47 +02:00
let message = ( JSON . parse ( body ) || { } ) . message ;
2021-06-06 13:49:58 +02:00
let result = message && ( message . body || message . result ) ;
if ( result && result . translatedText ) callback ( result . translatedText ) ;
2020-09-19 20:49:33 +02:00
else callback ( "" ) ;
}
catch ( err ) { callback ( "" ) ; }
}
else {
2022-09-07 13:47:41 +02:00
if ( response . statusCode == 429 ) BDFDB . NotificationUtils . toast ( ` ${ this . labels . toast _translating _failed } . ${ this . labels . toast _translating _tryanother } . ${ this . labels . error _hourlylimit } ` , {
2021-04-07 16:36:21 +02:00
type : "danger" ,
position : "center"
} ) ;
2022-09-07 13:47:41 +02:00
else BDFDB . NotificationUtils . toast ( ` ${ this . labels . toast _translating _failed } . ${ this . labels . toast _translating _tryanother } . ${ this . labels . error _serverdown } / ${ this . labels . error _keyoutdated } ` , {
2021-01-26 21:14:48 +01:00
type : "danger" ,
2021-01-28 14:11:00 +01:00
position : "center"
2021-01-26 21:14:48 +01:00
} ) ;
2020-09-19 20:49:33 +02:00
callback ( "" ) ;
}
} ) ;
}
2021-08-05 14:06:44 +02:00
baiduTranslate ( data , callback ) {
2023-04-14 19:02:10 +02:00
const credentials = ( authKeys . baidu && authKeys . baidu . key || "20221009001380882 TOPnUKz8jJ32AZNOuUhX" ) . split ( " " ) ;
2022-11-02 15:31:28 +01:00
const salt = BDFDB . NumberUtils . generateId ( ) ;
2022-11-02 12:40:53 +01:00
BDFDB . LibraryRequires . request ( "https://fanyi-api.baidu.com/api/trans/vip/translate" , {
method : "post" ,
2021-08-05 14:06:44 +02:00
form : {
from : translationEngines . baidu . parser [ data . input . id ] || data . input . id ,
to : translationEngines . baidu . parser [ data . output . id ] || data . output . id ,
2022-11-02 15:31:28 +01:00
q : encodeURIComponent ( data . text ) ,
2021-08-05 14:06:44 +02:00
appid : credentials [ 0 ] ,
2022-11-02 15:31:28 +01:00
salt : salt ,
sign : this . MD5 ( credentials [ 0 ] + data . text + salt + ( credentials [ 2 ] || credentials [ 1 ] ) )
2021-08-05 14:06:44 +02:00
}
} , ( error , response , result ) => {
if ( ! error && result && response . statusCode == 200 ) {
try {
result = JSON . parse ( result ) || { } ;
if ( ! result . error _code ) {
let messages = result . trans _result ;
if ( messages && messages . length > 0 && result . from != result . to ) callback ( messages . map ( message => decodeURIComponent ( message . dst ) ) . join ( "\n" ) ) ;
else { callback ( "" ) ; }
}
else {
BDFDB . NotificationUtils . toast ( ` ${ this . labels . toast _translating _failed } . ${ this . labels . toast _translating _tryanother } . ${ result . error _code } : ${ result . error _msg } . ` , {
type : "danger" ,
position : "center"
} ) ;
callback ( "" ) ;
}
}
catch ( err ) { callback ( "" ) ; }
}
else {
2022-09-07 13:47:41 +02:00
BDFDB . NotificationUtils . toast ( ` ${ this . labels . toast _translating _failed } . ${ this . labels . toast _translating _tryanother } . ${ this . labels . error _serverdown } ` , {
2021-08-05 14:06:44 +02:00
type : "danger" ,
position : "center"
} ) ;
callback ( "" ) ;
}
} ) ;
}
MD5 ( e ) {
function h ( a , b ) {
var e = a & 2147483648 , f = b & 2147483648 , c = a & 1073741824 , d = b & 1073741824 , g = ( a & 1073741823 ) + ( b & 1073741823 ) ;
return c & d ? g ^ 2147483648 ^ e ^ f : c | d ? g & 1073741824 ? g ^ 3221225472 ^ e ^ f : g ^ 1073741824 ^ e ^ f : g ^ e ^ f
}
function k ( a , b , c , d , e , f , g ) {
a = h ( a , h ( h ( b & c | ~ b & d , e ) , g ) ) ;
return h ( a << f | a >>> 32 - f , b ) ;
}
function l ( a , b , c , d , e , f , g ) {
a = h ( a , h ( h ( b & d | c & ~ d , e ) , g ) ) ;
return h ( a << f | a >>> 32 - f , b ) ;
}
function m ( a , b , d , c , e , f , g ) {
a = h ( a , h ( h ( b ^ d ^ c , e ) , g ) ) ;
return h ( a << f | a >>> 32 - f , b )
}
function n ( a , b , d , c , e , f , g ) {
a = h ( a , h ( h ( d ^ ( b | ~ c ) , e ) , g ) ) ;
return h ( a << f | a >>> 32 - f , b ) ;
}
function p ( a ) {
var b = "" , d = "" , c ;
for ( c = 0 ; 3 >= c ; c ++ ) d = a >>> 8 * c & 255 , d = "0" + d . toString ( 16 ) , b += d . substr ( d . length - 2 , 2 ) ;
return b ;
}
var f = [ ] , q , r , s , t , a , b , c , d ;
e = function ( a ) {
a = a . replace ( /\r\n/g , "\n" ) ;
for ( var b = "" , d = 0 ; d < a . length ; d ++ ) {
var c = a . charCodeAt ( d ) ;
128 > c ? b += String . fromCharCode ( c ) : ( 127 < c && 2048 > c ? b += String . fromCharCode ( c >> 6 | 192 ) : ( b += String . fromCharCode ( c >> 12 | 224 ) , b += String . fromCharCode ( c >> 6 & 63 | 128 ) ) , b += String . fromCharCode ( c & 63 | 128 ) )
}
return b ;
} ( e ) ;
f = function ( b ) {
var a , c = b . length ;
a = c + 8 ;
for ( var d = 16 * ( ( a - a % 64 ) / 64 + 1 ) , e = Array ( d - 1 ) , f = 0 , g = 0 ; g < c ; ) a = ( g - g % 4 ) / 4 , f = g % 4 * 8 , e [ a ] |= b . charCodeAt ( g ) << f , g ++ ;
a = ( g - g % 4 ) / 4 ;
e [ a ] |= 128 << g % 4 * 8 ;
e [ d - 2 ] = c << 3 ;
e [ d - 1 ] = c >>> 29 ;
return e
} ( e ) ;
a = 1732584193 , b = 4023233417 , c = 2562383102 , d = 271733878 ;
for ( e = 0 ; e < f . length ; e += 16 ) q = a , r = b , s = c , t = d , a = k ( a , b , c , d , f [ e + 0 ] , 7 , 3614090360 ) , d = k ( d , a , b , c , f [ e + 1 ] , 12 , 3905402710 ) , c = k ( c , d , a , b , f [ e + 2 ] , 17 , 606105819 ) , b = k ( b , c , d , a , f [ e + 3 ] , 22 , 3250441966 ) , a = k ( a , b , c , d , f [ e + 4 ] , 7 , 4118548399 ) , d = k ( d , a , b , c , f [ e + 5 ] , 12 , 1200080426 ) , c = k ( c , d , a , b , f [ e + 6 ] , 17 , 2821735955 ) , b = k ( b , c , d , a , f [ e + 7 ] , 22 , 4249261313 ) , a = k ( a , b , c , d , f [ e + 8 ] , 7 , 1770035416 ) , d = k ( d , a , b , c , f [ e + 9 ] , 12 , 2336552879 ) , c = k ( c , d , a , b , f [ e + 10 ] , 17 , 4294925233 ) , b = k ( b , c , d , a , f [ e + 11 ] , 22 , 2304563134 ) , a = k ( a , b , c , d , f [ e + 12 ] , 7 , 1804603682 ) , d = k ( d , a , b , c , f [ e + 13 ] , 12 , 4254626195 ) , c = k ( c , d , a , b , f [ e + 14 ] , 17 , 2792965006 ) , b = k ( b , c , d , a , f [ e + 15 ] , 22 , 1236535329 ) , a = l ( a , b , c , d , f [ e + 1 ] , 5 , 4129170786 ) , d = l ( d , a , b , c , f [ e + 6 ] , 9 , 3225465664 ) , c = l ( c , d , a , b , f [ e + 11 ] , 14 , 643717713 ) , b = l ( b , c , d , a , f [ e + 0 ] , 20 , 3921069994 ) , a = l ( a , b , c , d , f [ e + 5 ] , 5 , 3593408605 ) , d = l ( d , a , b , c , f [ e + 10 ] , 9 , 38016083 ) , c = l ( c , d , a , b , f [ e + 15 ] , 14 , 3634488961 ) , b = l ( b , c , d , a , f [ e + 4 ] , 20 , 3889429448 ) , a = l ( a , b , c , d , f [ e + 9 ] , 5 , 568446438 ) , d = l ( d , a , b , c , f [ e + 14 ] , 9 , 3275163606 ) , c = l ( c , d , a , b , f [ e + 3 ] , 14 , 4107603335 ) , b = l ( b , c , d , a , f [ e + 8 ] , 20 , 1163531501 ) , a = l ( a , b , c , d , f [ e + 13 ] , 5 , 2850285829 ) , d = l ( d , a , b , c , f [ e + 2 ] , 9 , 4243563512 ) , c = l ( c , d , a , b , f [ e + 7 ] , 14 , 1735328473 ) , b = l ( b , c , d , a , f [ e + 12 ] , 20 , 2368359562 ) , a = m ( a , b , c , d , f [ e + 5 ] , 4 , 4294588738 ) , d = m ( d , a , b , c , f [ e + 8 ] , 11 , 2272392833 ) , c = m ( c , d , a , b , f [ e + 11 ] , 16 , 1839030562 ) , b = m ( b , c , d , a , f [ e + 14 ] , 23 , 4259657740 ) , a = m ( a , b , c , d , f [ e + 1 ] , 4 , 2763975236 ) , d = m ( d , a , b , c , f [ e + 4 ] , 11 , 1272893353 ) , c = m ( c , d , a , b , f [ e + 7 ] , 16 , 4139469664 ) , b = m ( b , c , d , a , f [ e + 10 ] , 23 , 3200236656 ) , a = m ( a , b , c , d , f [ e + 13 ] , 4 , 681279174 ) , d = m ( d , a , b , c , f [ e + 0 ] , 11 , 3936430074 ) , c = m ( c , d , a , b , f [ e + 3 ] , 16 , 3572445317 ) , b = m ( b , c , d , a , f [ e + 6 ] , 23 , 76029189 ) , a = m ( a , b , c , d , f [ e + 9 ] , 4 , 3654602809 ) , d = m ( d , a , b , c , f [ e + 12 ] , 11 , 3873151461 ) , c = m ( c , d , a , b , f [ e + 15 ] , 16 , 530742520 ) , b = m ( b , c , d , a , f [ e + 2 ] , 23 , 3299628645 ) , a = n ( a , b , c , d , f [ e + 0 ] , 6 , 4096336452 ) , d = n ( d , a , b , c , f [ e + 7 ] , 10 , 1126891415 ) , c = n ( c , d , a , b , f [ e + 14 ] , 15 , 2878612391 ) , b = n ( b , c , d , a , f [ e + 5 ] , 21 , 4237533241 ) , a = n ( a , b , c , d , f [ e + 12 ] , 6 , 1700485571 ) , d = n ( d , a , b , c , f [ e + 3 ] , 10 , 2399980690 ) , c = n ( c , d , a , b , f [ e + 10 ] , 15 , 4293915773 ) , b = n ( b , c , d , a , f [ e + 1 ] , 21 , 2240044497 ) , a = n ( a , b , c , d , f [ e + 8 ] , 6 , 1873313359 ) , d = n ( d , a , b , c , f [ e + 15 ] , 10 , 4264355552 ) , c = n ( c , d , a , b , f [ e + 6 ] , 15 , 2734768916 ) , b = n ( b , c , d , a , f [ e + 13 ] , 21 , 1309151649 ) , a = n ( a , b , c , d , f [ e + 4 ] , 6 , 4149444226 ) , d = n ( d , a , b , c , f [ e + 11 ] , 10 , 3174756917 ) , c = n ( c , d , a , b , f [ e + 2 ] , 15 , 718787259 ) , b = n ( b , c , d , a , f [ e + 9 ] , 21 , 3951481745 ) , a = h ( a , q ) , b = h ( b , r ) , c = h ( c , s ) , d = h ( d , t ) ;
return ( p ( a ) + p ( b ) + p ( c ) + p ( d ) ) . toLowerCase ( ) ;
}
2020-02-04 08:20:40 +01:00
2020-09-19 20:49:33 +02:00
checkForSpecialCase ( text , input ) {
2021-05-12 18:41:59 +02:00
if ( input . special ) return input ;
else if ( input . auto ) {
2020-09-19 20:49:33 +02:00
if ( /^[0-1]*$/ . test ( text . replace ( /\s/g , "" ) ) ) {
return { id : "binary" , name : "Binary" } ;
}
else if ( /^[⠁⠂⠃⠄⠅⠆⠇⠈⠉⠊⠋⠌⠍⠎⠏⠐⠑⠒⠓⠔⠕⠖⠗⠘⠙⠚⠛⠜⠝⠞⠟⠠⠡⠢⠣⠤⠥⠦⠧⠨⠩⠪⠫⠬⠭⠮⠯⠰⠱⠲⠳⠴⠵⠶⠷⠸⠹⠺⠻⠼⠽⠾⠿]*$/ . test ( text . replace ( /\s/g , "" ) ) ) {
return { id : "braille" , name : "Braille 6-dot" } ;
}
else if ( /^[/|·−._-]*$/ . test ( text . replace ( /\s/g , "" ) ) ) {
return { id : "morse" , name : "Morse" } ;
}
2019-12-10 13:21:59 +01:00
}
2020-09-19 20:49:33 +02:00
return null ;
2019-04-16 00:30:33 +02:00
}
2020-09-19 20:49:33 +02:00
string2binary ( string ) {
let binary = "" ;
for ( let character of string ) binary += parseInt ( character . charCodeAt ( 0 ) . toString ( 2 ) ) . toPrecision ( 8 ) . split ( "." ) . reverse ( ) . join ( "" ) . toString ( ) + " " ;
return binary ;
}
2019-04-16 00:30:33 +02:00
2020-09-19 20:49:33 +02:00
string2braille ( string ) {
let braille = "" ;
for ( let character of string ) braille += brailleConverter [ character . toLowerCase ( ) ] ? brailleConverter [ character . toLowerCase ( ) ] : character ;
return braille ;
}
2019-04-16 00:30:33 +02:00
2020-09-19 20:49:33 +02:00
string2morse ( string ) {
string = string . replace ( / /g , "%%%%%%%%%%" ) ;
let morse = "" ;
for ( let character of string ) morse += ( morseConverter [ character . toLowerCase ( ) ] ? morseConverter [ character . toLowerCase ( ) ] : character ) + " " ;
morse = morse . split ( "\n" ) ;
for ( let i in morse ) morse [ i ] = morse [ i ] . trim ( ) ;
return morse . join ( "\n" ) . replace ( /% % % % % % % % % % /g , "/ " ) ;
}
2019-04-16 00:30:33 +02:00
2020-09-19 20:49:33 +02:00
binary2string ( binary ) {
let string = "" ;
binary = binary . replace ( /\n/g , "00001010" ) . replace ( /\r/g , "00001101" ) . replace ( /\t/g , "00001001" ) . replace ( /\s/g , "" ) ;
if ( /^[0-1]*$/ . test ( binary ) ) {
2021-01-28 14:45:45 +01:00
let eightDigits = "" ;
2020-09-19 20:49:33 +02:00
let counter = 0 ;
for ( let digit of binary ) {
2021-01-28 14:45:45 +01:00
eightDigits += digit ;
2020-09-19 20:49:33 +02:00
counter ++ ;
if ( counter > 7 ) {
2021-01-28 14:45:45 +01:00
string += String . fromCharCode ( parseInt ( eightDigits , 2 ) . toString ( 10 ) ) ;
eightDigits = "" ;
2020-09-19 20:49:33 +02:00
counter = 0 ;
}
2020-02-04 08:20:40 +01:00
}
2019-04-16 00:30:33 +02:00
}
2021-01-26 21:14:48 +01:00
else BDFDB . NotificationUtils . toast ( "Invalid binary format. Only use 0s and 1s." , {
type : "danger" ,
2021-01-28 14:11:00 +01:00
position : "center"
2021-01-26 21:14:48 +01:00
} ) ;
2020-09-19 20:49:33 +02:00
return string ;
2019-04-16 00:30:33 +02:00
}
2019-01-26 22:45:19 +01:00
2020-09-19 20:49:33 +02:00
braille2string ( braille ) {
let string = "" ;
for ( let character of braille ) string += brailleConverter [ character . toLowerCase ( ) ] ? brailleConverter [ character . toLowerCase ( ) ] : character ;
return string ;
2020-02-04 08:20:40 +01:00
}
2019-01-26 22:45:19 +01:00
2020-09-19 20:49:33 +02:00
morse2string ( morse ) {
let string = "" ;
for ( let word of morse . replace ( /[_-]/g , "− " ) . replace ( /\./g , "·" ) . replace ( /\r|\t/g , "" ) . split ( /\/|\||\n/g ) ) {
for ( let characterstr of word . trim ( ) . split ( " " ) ) string += morseConverter [ characterstr ] ? morseConverter [ characterstr ] : characterstr ;
string += " " ;
}
return string . trim ( ) ;
2018-10-11 10:21:26 +02:00
}
2020-02-04 08:20:40 +01:00
2020-10-31 11:43:29 +01:00
addExceptions ( string , excepts ) {
for ( let count in excepts ) {
2021-03-20 18:50:17 +01:00
let exception = BDFDB . ArrayUtils . is ( this . settings . exceptions . wordStart ) && this . settings . exceptions . wordStart . some ( n => excepts [ count ] . indexOf ( n ) == 0 ) ? excepts [ count ] . slice ( 1 ) : excepts [ count ] ;
2023-02-23 18:28:18 +01:00
let newString = string . replace ( new RegExp ( ` [{ \{ ] \\ s*[{ \{ ] \\ s* ${ count } \\ s*[} \} ] \\ s*[} \} ] ` ) , exception ) ;
2021-02-04 14:45:34 +01:00
if ( newString == string ) string = newString + " " + exception ;
else string = newString ;
2019-01-02 23:28:11 +01:00
}
2020-09-19 20:49:33 +02:00
return string ;
2020-02-04 08:20:40 +01:00
}
2020-09-19 20:49:33 +02:00
2021-06-01 16:17:59 +02:00
removeExceptions ( string , place ) {
2023-02-15 13:57:48 +01:00
let emojiRegex = /[\uD83C-\uDBFF\uDC00-\uDFFF]+/ ;
2020-10-31 11:43:29 +01:00
let excepts = { } , newString = [ ] , count = 0 ;
2021-06-01 16:17:59 +02:00
if ( place == messageTypes . RECEIVED ) {
2020-09-19 20:49:33 +02:00
let text = [ ] , i = 0 ;
2023-02-15 13:57:48 +01:00
string . split ( "" ) . forEach ( ( chara , index , array ) => {
if ( chara == "<" && text [ i ] || emojiRegex . test ( chara ) && emojiRegex . test ( array [ index + 1 ] ) ) i ++ ;
2020-09-19 20:49:33 +02:00
text [ i ] = text [ i ] ? text [ i ] + chara : chara ;
2023-02-15 13:57:48 +01:00
if ( chara == ">" || emojiRegex . test ( chara ) && emojiRegex . test ( array [ index - 1 ] ) ) i ++ ;
2020-09-19 20:49:33 +02:00
} ) ;
for ( let j in text ) {
2023-02-15 13:57:48 +01:00
if ( text [ j ] . indexOf ( "<" ) == 0 || emojiRegex . test ( text [ j ] ) ) {
2021-02-04 14:45:34 +01:00
newString . push ( ` {{ ${ count } }} ` ) ;
2020-10-31 11:43:29 +01:00
excepts [ count ] = text [ j ] ;
2020-09-19 20:49:33 +02:00
count ++ ;
}
else newString . push ( text [ j ] ) ;
2020-02-04 08:20:40 +01:00
}
2020-09-19 20:49:33 +02:00
}
else {
2021-03-20 18:50:17 +01:00
let usedExceptions = BDFDB . ArrayUtils . is ( this . settings . exceptions . wordStart ) ? this . settings . exceptions . wordStart : [ ] ;
2020-09-19 20:49:33 +02:00
string . split ( " " ) . forEach ( word => {
2023-02-15 13:57:48 +01:00
if ( emojiRegex . test ( word ) || word . indexOf ( "<@!" ) == 0 || word . indexOf ( "<#" ) == 0 || word . indexOf ( ":" ) == 0 || word . indexOf ( "<:" ) == 0 || word . indexOf ( "<a:" ) == 0 || word . indexOf ( "@" ) == 0 || word . indexOf ( "#" ) == 0 || usedExceptions . some ( n => word . indexOf ( n ) == 0 && word . length > 1 ) ) {
2021-02-04 14:45:34 +01:00
newString . push ( ` {{ ${ count } }} ` ) ;
2020-10-31 11:43:29 +01:00
excepts [ count ] = word ;
2020-09-19 20:49:33 +02:00
count ++ ;
}
else newString . push ( word ) ;
} ) ;
}
2020-10-31 11:43:29 +01:00
return [ newString . join ( " " ) , excepts , newString . length - count != 0 ] ;
2020-02-04 08:20:40 +01:00
}
2019-01-26 22:45:19 +01:00
2020-09-19 20:49:33 +02:00
getGoogleTranslatePageURL ( input , output , text ) {
2020-11-19 16:45:36 +01:00
return ` https://translate.google.com/# ${ BDFDB . LanguageUtils . languages [ input ] ? input : "auto" } / ${ output } / ${ encodeURIComponent ( text ) } ` ;
2020-09-19 20:49:33 +02:00
}
2020-07-26 17:02:25 +02:00
2021-01-06 12:38:36 +01:00
setLabelsByLanguage ( ) {
2020-09-19 20:49:33 +02:00
switch ( BDFDB . LanguageUtils . getLanguage ( ) . id ) {
2020-12-21 19:56:36 +01:00
case "bg" : // Bulgarian
return {
2022-09-07 13:47:41 +02:00
backup _engine : "Резервен-Преводач" ,
backup _engine _warning : "Ще използва Резервен-Преводач" ,
2020-12-21 19:56:36 +01:00
context _messagetranslateoption : "Превод на съобщението" ,
context _messageuntranslateoption : "Превод на съобщението" ,
2022-09-07 13:47:41 +02:00
context _translator : "Търсене превод" ,
detect _language : "Разпознаване на езика" ,
error _dailylimit : "Дневният лимит на заявките е достигнат." ,
error _hourlylimit : "Почасовият лимит на заявките е достигнат." ,
error _keyoutdated : "API-ключът е остарял." ,
error _monthlylimit : "Месечният лимит на заявките е достигнат." ,
error _serverdown : "Сървърът за превод може да е офлайн." ,
exception _text : "Думите, започващи с {{var0}}, ще бъдат игнорирани" ,
general _addTranslateButton : "Добавя бутон за превод към текстовото поле на канала" ,
general _sendOriginalMessage : "Също така изпраща оригиналното съобщение, когато превежда вашето изпратено съобщение" ,
general _showOriginalMessage : "Също така показва оригиналното съобщение при превод на получено съобщение" ,
general _usePerChatTranslation : "Активира/деактивира състоянието на бутона за преводач за всеки канал, а не глобално" ,
language _choice _input _received : "Език на въвеждане в получените съобщения" ,
language _choice _input _sent : "Език на въвеждане в изпратените от вас съобщения" ,
language _choice _output _received : "Изходен език в получените съобщения" ,
language _choice _output _sent : "Изходен език в изпратените ви съобщения" ,
language _selection _channel : "Изборът на език ще бъде променен специално за този канал" ,
language _selection _global : "Изборът на език ще бъде променен за всички сървъри" ,
language _selection _server : "Изборът на език ще бъде променен специално за този сървър" ,
2020-12-21 19:56:36 +01:00
popout _translateoption : "Превод" ,
popout _untranslateoption : "Непревод" ,
2021-01-26 21:14:48 +01:00
toast _translating : "Превод" ,
toast _translating _failed : "Преводът не б е успешен" ,
toast _translating _tryanother : "Опитайте друг преводач" ,
2022-09-07 13:47:41 +02:00
translate _your _message : "Преведете вашите съобщения преди изпращане" ,
translated _watermark : "преведено" ,
translator _engine : "Преводач"
} ;
case "cs" : // Czech
return {
backup _engine : "Backup-Překladatel" ,
backup _engine _warning : "Použije Backup-Překladatel" ,
context _messagetranslateoption : "Přeložit zprávu" ,
context _messageuntranslateoption : "Přeložit zprávu" ,
context _translator : "Hledat Překlad" ,
detect _language : "Rozpoznat jazyk" ,
error _dailylimit : "Denní limit požadavků byl dosažen." ,
error _hourlylimit : "Bylo dosaženo limitu hodinového požadavku." ,
error _keyoutdated : "Klíč API je zastaralý." ,
error _monthlylimit : "Byl dosažen limit měsíčních požadavků." ,
error _serverdown : "Překladový server může být offline." ,
exception _text : "Slova začínající na {{var0}} budou ignorována" ,
general _addTranslateButton : "Přidá tlačítko Přeložit do textové oblasti kanálu" ,
general _sendOriginalMessage : "Při překladu odeslané zprávy také odešle původní zprávu" ,
general _showOriginalMessage : "Také zobrazuje původní zprávu při překladu přijaté zprávy" ,
general _usePerChatTranslation : "Povolí/zakáže stav tlačítka překladače pro kanál, nikoli globálně" ,
language _choice _input _received : "Vstupní jazyk do přijatých zpráv" ,
language _choice _input _sent : "Zadejte jazyk do odeslaných zpráv" ,
language _choice _output _received : "Výstupní jazyk v přijatých zprávách" ,
language _choice _output _sent : "Jazyk výstupu ve vašich odeslaných zprávách" ,
language _selection _channel : "Výběr jazyka bude změněn speciálně pro tento kanál" ,
language _selection _global : "Výběr jazyka se změní pro všechny servery" ,
language _selection _server : "Výběr jazyka bude změněn speciálně pro tento server" ,
popout _translateoption : "Přeložit" ,
popout _untranslateoption : "Nepřeložit" ,
toast _translating : "Překládání" ,
toast _translating _failed : "Překlad se nezdařil" ,
toast _translating _tryanother : "Zkuste jiný překladač" ,
translate _your _message : "Před odesláním si zprávy přeložte" ,
translated _watermark : "přeloženo" ,
translator _engine : "Překladatel"
2020-12-21 19:56:36 +01:00
} ;
case "da" : // Danish
return {
2022-09-07 13:47:41 +02:00
backup _engine : "Backup-Oversætter" ,
backup _engine _warning : "Vil bruge Backup-Oversætter" ,
2020-12-21 19:56:36 +01:00
context _messagetranslateoption : "Oversæt besked" ,
context _messageuntranslateoption : "Ikke-oversat besked" ,
2022-09-07 13:47:41 +02:00
context _translator : "Søg oversættelse" ,
detect _language : "Find sprog" ,
error _dailylimit : "Daglig anmodningsgrænse nået." ,
error _hourlylimit : "Timegrænsen for anmodning er nået." ,
error _keyoutdated : "API-nøgle forældet." ,
error _monthlylimit : "Månedlig anmodningsgrænse nået." ,
error _serverdown : "Oversættelsesserveren er muligvis offline." ,
exception _text : "Ord, der begynder med {{var0}}, ignoreres" ,
general _addTranslateButton : "Tilføjer en Oversæt-knap til kanaltekstområdet" ,
general _sendOriginalMessage : "Sender også den originale besked, når du oversætter din sendte besked" ,
general _showOriginalMessage : "Viser også den originale besked, når du oversætter modtaget besked" ,
general _usePerChatTranslation : "Aktiverer/deaktiverer oversætterknappens tilstand pr. kanal og ikke globalt" ,
language _choice _input _received : "Inputsprog i modtagne beskeder" ,
language _choice _input _sent : "Indtast sprog i dine sendte beskeder" ,
language _choice _output _received : "Outputsprog i modtagne beskeder" ,
language _choice _output _sent : "Outputsprog i dine sendte beskeder" ,
language _selection _channel : "Valg af sprog vil blive ændret specifikt for denne kanal" ,
language _selection _global : "Valg af sprog vil blive ændret for alle servere" ,
language _selection _server : "Sprogvalg vil blive ændret specifikt for denne server" ,
2020-12-21 19:56:36 +01:00
popout _translateoption : "Oversætte" ,
popout _untranslateoption : "Untranslate" ,
2021-01-26 21:14:48 +01:00
toast _translating : "Oversætter" ,
toast _translating _failed : "Kunne ikke oversætte" ,
toast _translating _tryanother : "Prøv en anden oversætter" ,
2022-09-07 13:47:41 +02:00
translate _your _message : "Oversæt dine beskeder før afsendelse" ,
translated _watermark : "oversat" ,
translator _engine : "Oversætter"
2020-12-21 19:56:36 +01:00
} ;
case "de" : // German
return {
2022-09-07 13:47:41 +02:00
backup _engine : "Backup-Übersetzer" ,
backup _engine _warning : "Wird Backup-Übersetzer verwenden" ,
2020-12-21 19:56:36 +01:00
context _messagetranslateoption : "Nachricht übersetzen" ,
context _messageuntranslateoption : "Nachricht unübersetzen" ,
2022-09-07 13:47:41 +02:00
context _translator : "Übersetzung suchen" ,
detect _language : "Sprache erkennen" ,
error _dailylimit : "Tägliches Anforderungslimit erreicht." ,
error _hourlylimit : "Stündliches Anforderungslimit erreicht." ,
error _keyoutdated : "API-Schlüssel veraltet." ,
error _monthlylimit : "Monatliches Anforderungslimit erreicht." ,
error _serverdown : "Der Übersetzungsserver ist möglicherweise offline." ,
exception _text : "Wörter, die mit {{var0}} beginnen, werden ignoriert" ,
general _addTranslateButton : "Fügt dem Textbereich des Kanals eine Schalter zum Übersetzen hinzu" ,
general _sendOriginalMessage : "Sendet auch die ursprüngliche Nachricht, wenn die gesendete Nachricht übersetzt wird" ,
general _showOriginalMessage : "Zeigt auch die ursprüngliche Nachricht an, wenn eine empfangene Nachricht übersetzt wird" ,
general _usePerChatTranslation : "Aktiviert/deaktiviert die Übersetzung pro Kanal und nicht global" ,
language _choice _input _received : "Eingabesprache in empfangenen Nachrichten" ,
language _choice _input _sent : "Eingabesprache in gesendeten Nachrichten" ,
language _choice _output _received : "Ausgabesprache in empfangenen Nachrichten" ,
language _choice _output _sent : "Ausgabesprache in gesendeten Nachrichten" ,
language _selection _channel : "Die Sprachauswahl wird speziell für diesen Kanal geändert" ,
language _selection _global : "Die Sprachauswahl wird für alle Server geändert" ,
language _selection _server : "Die Sprachauswahl wird speziell für diesen Server geändert" ,
2020-12-21 19:56:36 +01:00
popout _translateoption : "Übersetzen" ,
popout _untranslateoption : "Unübersetzen" ,
2021-01-26 21:14:48 +01:00
toast _translating : "Übersetzen" ,
toast _translating _failed : "Übersetzung fehlgeschlagen" ,
toast _translating _tryanother : "Versuch einen anderen Übersetzer" ,
2022-09-07 13:47:41 +02:00
translate _your _message : "Übersetzt Nachrichten vor dem Senden" ,
translated _watermark : "übersetzt" ,
translator _engine : "Übersetzer"
2020-12-21 19:56:36 +01:00
} ;
case "el" : // Greek
return {
2023-03-30 16:45:02 +02:00
backup _engine : "Μεταφράστης-Αντίγραφο ασφαλείας" ,
backup _engine _warning : "Θα χρησιμοποιηθεί Μεταφράστης-Αντίγραφο ασφαλείας" ,
2020-12-21 19:56:36 +01:00
context _messagetranslateoption : "Μετάφραση μηνύματος" ,
2023-03-30 16:45:02 +02:00
context _messageuntranslateoption : "Αναίρεση μετάφρασης μηνύματος" ,
2022-09-07 13:47:41 +02:00
context _translator : "Αναζήτηση μετάφρασης" ,
detect _language : "Εντοπισμός γλώσσας" ,
error _dailylimit : "Συμπληρώθηκε το ημερήσιο όριο αιτημάτων." ,
2023-03-30 16:45:02 +02:00
error _hourlylimit : "Συμπληρώθηκε το ωριαίο όριο αιτημάτων." ,
2022-09-07 13:47:41 +02:00
error _keyoutdated : "Τ ο κλειδί API δεν είναι ενημερωμένο." ,
error _monthlylimit : "Συμπληρώθηκε το μηνιαίο όριο αιτημάτων." ,
error _serverdown : "Ο διακομιστής μετάφρασης ενδέχεται ν α είναι εκτός σύνδεσης." ,
2023-04-19 10:39:58 +02:00
exception _text : "Ο ι λέξεις θα αγνοηθούν που ξεκινούν με {{var0}}" ,
general _addTranslateButton : "Προσθήκη κουμπιού μετάφρασης στην Περιοχή κειμένου του Καναλιού" ,
general _sendOriginalMessage : "Αποστολή αρχικού Μηνύματος με τη μετάφραση απεσταλμένου μηνύματος" ,
general _showOriginalMessage : "Εμφάνιση αρχικού Μηνύματος με τη μετάφραση ενός ληφθέντος μηνύματος" ,
general _usePerChatTranslation : "(Απ)Ενεργοποίηση κατάστασης κουμπιού μεταφραστή ανά κανάλι" ,
2022-09-07 13:47:41 +02:00
language _choice _input _received : "Γλώσσα εισαγωγής στα ληφθέντα μηνύματα" ,
2023-03-30 16:45:02 +02:00
language _choice _input _sent : "Γλώσσα εισαγωγής στα απεσταλμένα μηνύματά σας" ,
language _choice _output _received : "Γλώσσα εξαγωγής στα ληφθέντα μηνύματα" ,
language _choice _output _sent : "Γλώσσα εξαγωγής στα απεσταλμένα μηνύματά σας" ,
2022-09-07 13:47:41 +02:00
language _selection _channel : "Η επιλογή γλώσσας θα αλλάξει ειδικά γ ι α αυτό το κανάλι" ,
language _selection _global : "Η Επιλογή Γλώσσας θα αλλάξει γ ι α όλους τους Διακομιστές" ,
language _selection _server : "Η επιλογή γλώσσας θα αλλάξει ειδικά γ ι α αυτόν τον διακομιστή" ,
2023-03-30 16:45:02 +02:00
popout _translateoption : "Μετάφραση" ,
popout _untranslateoption : "Αναίρεση μετάφρασης" ,
2021-01-26 21:14:48 +01:00
toast _translating : "Μετάφραση" ,
toast _translating _failed : "Αποτυχία μετάφρασης" ,
toast _translating _tryanother : "Δοκιμάστε έναν άλλο Μεταφραστή" ,
2023-03-30 16:45:02 +02:00
translate _your _message : "Μεταφράστε τα Μηνύματά σας πριν την αποστολή" ,
2022-09-07 13:47:41 +02:00
translated _watermark : "μεταφρασμένο" ,
translator _engine : "Μεταφράστης"
2020-12-21 19:56:36 +01:00
} ;
case "es" : // Spanish
return {
2022-09-07 13:47:41 +02:00
backup _engine : "Backup-Traductor" ,
backup _engine _warning : "Utilizará Backup-Traductor" ,
2020-12-21 19:56:36 +01:00
context _messagetranslateoption : "Traducir mensaje" ,
context _messageuntranslateoption : "Mensaje sin traducir" ,
2022-09-07 13:47:41 +02:00
context _translator : "Buscar traducción" ,
detect _language : "Detectar idioma" ,
error _dailylimit : "Se alcanzó el límite de solicitudes diarias." ,
error _hourlylimit : "Se alcanzó el límite de solicitudes por hora." ,
error _keyoutdated : "API-Key obsoleta." ,
error _monthlylimit : "Se alcanzó el límite de solicitudes mensuales." ,
error _serverdown : "El servidor de traducción puede estar fuera de línea." ,
exception _text : "Las palabras que comienzan con {{var0}} serán ignoradas" ,
general _addTranslateButton : "Agrega un botón de traducción al área de texto del canal" ,
general _sendOriginalMessage : "También envía el mensaje original al traducir su mensaje enviado" ,
general _showOriginalMessage : "También muestra el mensaje original al traducir un mensaje recibido" ,
general _usePerChatTranslation : "Habilita/deshabilita el estado del botón del traductor por canal y no globalmente" ,
language _choice _input _received : "Idioma de entrada en los mensajes recibidos" ,
language _choice _input _sent : "Idioma de entrada en sus mensajes enviados" ,
language _choice _output _received : "Idioma de salida en los mensajes recibidos" ,
language _choice _output _sent : "Idioma de salida en sus mensajes enviados" ,
language _selection _channel : "La selección de idioma se cambiará específicamente para este canal" ,
language _selection _global : "La selección de idioma se cambiará para todos los servidores" ,
language _selection _server : "La selección de idioma se cambiará específicamente para este servidor" ,
2020-12-21 19:56:36 +01:00
popout _translateoption : "Traducir" ,
popout _untranslateoption : "No traducir" ,
2021-01-26 21:14:48 +01:00
toast _translating : "Traductorio" ,
toast _translating _failed : "No se pudo traducir" ,
toast _translating _tryanother : "Prueba con otro traductor" ,
2022-09-07 13:47:41 +02:00
translate _your _message : "Traduce tus mensajes antes de enviarlos" ,
translated _watermark : "traducido" ,
translator _engine : "Traductor"
2020-12-21 19:56:36 +01:00
} ;
case "fi" : // Finnish
return {
2022-09-07 13:47:41 +02:00
backup _engine : "Backup-Kääntäjä" ,
backup _engine _warning : "Käyttää Backup-Kääntäjä" ,
2020-12-21 19:56:36 +01:00
context _messagetranslateoption : "Käännä viesti" ,
context _messageuntranslateoption : "Käännä viesti" ,
2022-09-07 13:47:41 +02:00
context _translator : "Hae käännöstä" ,
detect _language : "Tunnista kieli" ,
error _dailylimit : "Päivittäinen pyyntöraja saavutettu." ,
error _hourlylimit : "Tuntikohtainen pyyntöraja saavutettu." ,
error _keyoutdated : "API-avain vanhentunut." ,
error _monthlylimit : "Kuukauden pyyntöraja saavutettu." ,
error _serverdown : "Käännöspalvelin saattaa olla offline-tilassa." ,
exception _text : "{{var0}} alkavat sanat ohitetaan" ,
general _addTranslateButton : "Lisää käännöspainikkeen kanavan tekstialueeseen" ,
general _sendOriginalMessage : "Lähettää myös alkuperäisen viestin kääntäessään lähettämääsi viestiä" ,
general _showOriginalMessage : "Näyttää myös alkuperäisen viestin käännettäessä vastaanotettua viestiä" ,
general _usePerChatTranslation : "Ottaa käyttöön/poistaa käytöstä kääntäjän painikkeen tilan kanavakohtaisesti, ei maailmanlaajuisesti" ,
language _choice _input _received : "Syöttökieli vastaanotetuissa viesteissä" ,
language _choice _input _sent : "Syötä kieli lähettämiisi viesteihin" ,
language _choice _output _received : "Tulostuskieli vastaanotetuissa viesteissä" ,
language _choice _output _sent : "Lähetyskieli lähetetyissä viesteissä" ,
language _selection _channel : "Kielen valintaa muutetaan erityisesti tätä kanavaa varten" ,
language _selection _global : "Kielen valintaa muutetaan kaikille palvelimille" ,
language _selection _server : "Kielen valintaa muutetaan erityisesti tätä palvelinta varten" ,
2020-12-21 19:56:36 +01:00
popout _translateoption : "Kääntää" ,
popout _untranslateoption : "Käännä" ,
2021-01-26 21:14:48 +01:00
toast _translating : "Kääntäminen" ,
toast _translating _failed : "Käännös epäonnistui" ,
toast _translating _tryanother : "Kokeile toista kääntäjää" ,
2022-09-07 13:47:41 +02:00
translate _your _message : "Käännä viestisi ennen lähettämistä" ,
translated _watermark : "käännetty" ,
translator _engine : "Kääntäjä"
2020-12-21 19:56:36 +01:00
} ;
case "fr" : // French
2020-09-19 20:49:33 +02:00
return {
2022-09-07 13:47:41 +02:00
backup _engine : "Backup-Traducteur" ,
backup _engine _warning : "Utilisera Backup-Traducteur" ,
2020-12-21 19:56:36 +01:00
context _messagetranslateoption : "Traduire le message" ,
context _messageuntranslateoption : "Message non traduit" ,
2022-09-07 13:47:41 +02:00
context _translator : "Recherche de traduction" ,
detect _language : "Détecter la langue" ,
error _dailylimit : "Limite quotidienne de requêtes atteinte." ,
error _hourlylimit : "Limite horaire de demandes atteinte." ,
error _keyoutdated : "Clé API obsolète." ,
error _monthlylimit : "Limite mensuelle de demandes atteinte." ,
error _serverdown : "Le serveur de traduction est peut-être hors ligne." ,
exception _text : "Les mots commençant par {{var0}} seront ignorés" ,
general _addTranslateButton : "Ajoute un bouton de traduction à la zone de texte du canal" ,
general _sendOriginalMessage : "Envoie également le message d'origine lors de la traduction de votre message envoyé" ,
general _showOriginalMessage : "Affiche également le message d'origine lors de la traduction d'un message reçu" ,
general _usePerChatTranslation : "Active/désactive l'état du bouton du traducteur par canal et non globalement" ,
language _choice _input _received : "Langue d'entrée dans les messages reçus" ,
language _choice _input _sent : "Langue d'entrée dans vos messages envoyés" ,
language _choice _output _received : "Langue de sortie dans les messages reçus" ,
language _choice _output _sent : "Langue de sortie dans vos messages envoyés" ,
language _selection _channel : "La sélection de la langue sera modifiée spécifiquement pour ce canal" ,
language _selection _global : "La sélection de la langue sera modifiée pour tous les serveurs" ,
language _selection _server : "La sélection de la langue sera modifiée spécifiquement pour ce serveur" ,
2020-12-21 19:56:36 +01:00
popout _translateoption : "Traduire" ,
popout _untranslateoption : "Non traduit" ,
2021-01-26 21:14:48 +01:00
toast _translating : "Traduction en cours" ,
toast _translating _failed : "Échec de la traduction" ,
toast _translating _tryanother : "Essayez un autre traducteur" ,
2022-09-07 13:47:41 +02:00
translate _your _message : "Traduisez vos messages avant de les envoyer" ,
translated _watermark : "traduit" ,
translator _engine : "Traducteur"
} ;
case "hi" : // Hindi
return {
backup _engine : "बैकअप-अनुवादक" ,
backup _engine _warning : "बैकअप-अनुवादक का उपयोग करेंगे" ,
context _messagetranslateoption : "संदेश का अनुवाद करें" ,
context _messageuntranslateoption : "संदेश का अनुवाद न करें" ,
context _translator : "अनुवाद खोजें" ,
detect _language : "भाषा की जांच करो" ,
error _dailylimit : "दैनिक अनुरोध सीमा पूरी हो गई है।" ,
error _hourlylimit : "घंटे के अनुरोध की सीमा पूरी हो गई है." ,
error _keyoutdated : "एपीआई-कुंजी पुरानी हो चुकी है।" ,
error _monthlylimit : "मासिक अनुरोध सीमा पूरी हो गई है।" ,
error _serverdown : "अनुवाद सर्वर ऑफ़लाइन हो सकता है।" ,
exception _text : "{{var0}} से शुरू होने वाले शब्दों पर ध्यान नहीं दिया जाएगा" ,
general _addTranslateButton : "चैनल Textarea में एक अनुवाद बटन जोड़ता है" ,
general _sendOriginalMessage : "आपके भेजे गए संदेश का अनुवाद करते समय मूल संदेश भी भेजता है" ,
general _showOriginalMessage : "प्राप्त संदेश का अनुवाद करते समय मूल संदेश भी दिखाता है" ,
general _usePerChatTranslation : "प्रति चैनल अनुवादक बटन स्थिति को सक्षम/अक्षम करता है और विश्व स्तर पर नहीं" ,
language _choice _input _received : "प्राप्त संदेशों में इनपुट भाषा" ,
language _choice _input _sent : "आपके भेजे गए संदेशों में इनपुट भाषा" ,
language _choice _output _received : "प्राप्त संदेशों में आउटपुट भाषा" ,
language _choice _output _sent : "आपके भेजे गए संदेशों में आउटपुट भाषा" ,
language _selection _channel : "इस चैनल के लिए भाषा चयन विशेष रूप से बदला जाएगा" ,
language _selection _global : "सभी सर्वरों के लिए भाषा चयन बदल दिया जाएगा" ,
language _selection _server : "इस सर्वर के लिए भाषा चयन विशेष रूप से बदल दिया जाएगा" ,
popout _translateoption : "अनुवाद करना" ,
popout _untranslateoption : "अनुवाद न करें" ,
toast _translating : "अनुवाद" ,
toast _translating _failed : "अनुवाद करने में विफल" ,
toast _translating _tryanother : "दूसरे अनुवादक का प्रयास करें" ,
translate _your _message : "भेजने से पहले अपने संदेशों का अनुवाद करें" ,
translated _watermark : "अनुवाद" ,
translator _engine : "अनुवादक"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "hr" : // Croatian
2020-09-19 20:49:33 +02:00
return {
2022-09-07 13:47:41 +02:00
backup _engine : "Rezervni-Prevoditelj" ,
backup _engine _warning : "Koristit će se Rezervni-Prevoditelj" ,
2020-12-21 19:56:36 +01:00
context _messagetranslateoption : "Prevedi poruku" ,
context _messageuntranslateoption : "Prevedi poruku" ,
2022-09-07 13:47:41 +02:00
context _translator : "Pretraži prijevod" ,
detect _language : "Prepoznaj jezik" ,
error _dailylimit : "Dosegnuto je dnevno ograničenje zahtjeva." ,
error _hourlylimit : "Dosegnuto je ograničenje zahtjeva po satu." ,
error _keyoutdated : "API-ključ zastario." ,
error _monthlylimit : "Dosegnuto je mjesečno ograničenje zahtjeva." ,
error _serverdown : "Translation Server možda je offline." ,
exception _text : "Riječi koje počinju s {{var0}} bit će zanemarene" ,
general _addTranslateButton : "Dodaje gumb Prevedi tekstualnom području kanala" ,
general _sendOriginalMessage : "Također šalje izvornu poruku prilikom prijevoda vaše poslane poruke" ,
general _showOriginalMessage : "Također prikazuje izvornu poruku prilikom prijevoda primljene poruke" ,
general _usePerChatTranslation : "Omogućuje/onemogućuje stanje gumba prevoditelja po kanalu, a ne globalno" ,
language _choice _input _received : "Jezik unosa u primljenim porukama" ,
language _choice _input _sent : "Jezik unosa u vaše poslane poruke" ,
language _choice _output _received : "Izlazni jezik u primljenim porukama" ,
language _choice _output _sent : "Izlazni jezik u vašim poslanim porukama" ,
language _selection _channel : "Odabir jezika bit će promijenjen posebno za ovaj kanal" ,
language _selection _global : "Odabir jezika bit će promijenjen za sve poslužitelje" ,
language _selection _server : "Odabir jezika bit će promijenjen posebno za ovaj poslužitelj" ,
2020-12-21 19:56:36 +01:00
popout _translateoption : "Prevedi" ,
popout _untranslateoption : "Neprevedi" ,
2021-01-26 21:14:48 +01:00
toast _translating : "Prevođenje" ,
toast _translating _failed : "Prijevod nije uspio" ,
toast _translating _tryanother : "Pokušajte s drugim prevoditeljem" ,
2022-09-07 13:47:41 +02:00
translate _your _message : "Prevedite svoje poruke prije slanja" ,
translated _watermark : "prevedeno" ,
translator _engine : "Prevoditelj"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "hu" : // Hungarian
2020-09-19 20:49:33 +02:00
return {
2022-09-07 13:47:41 +02:00
backup _engine : "Backup-Fordító" ,
backup _engine _warning : "A Backup-Fordító programot fogja használni" ,
2020-12-21 19:56:36 +01:00
context _messagetranslateoption : "Üzenet lefordítása" ,
context _messageuntranslateoption : "Az üzenet lefordítása" ,
2022-09-07 13:47:41 +02:00
context _translator : "Keresés a fordításban" ,
detect _language : "Nyelvfelismerés" ,
error _dailylimit : "Elérte a napi igénylési korlátot." ,
error _hourlylimit : "Elérte az óránkénti igénylési korlátot." ,
error _keyoutdated : "API-kulcs elavult." ,
error _monthlylimit : "Elérte a havi igénylési limitet." ,
error _serverdown : "Lehet, hogy a Fordítószerver offline állapotban van." ,
exception _text : "A(z) {{var0}} kezdetű szavak figyelmen kívül maradnak" ,
general _addTranslateButton : "Fordítási gombot ad a csatorna szövegterületéhez" ,
general _sendOriginalMessage : "Az eredeti üzenetet is elküldi az elküldött üzenet fordítása során" ,
general _showOriginalMessage : "A fogadott üzenet lefordításakor az eredeti üzenetet is megjeleníti" ,
general _usePerChatTranslation : "Engedélyezi/letiltja a Fordító gomb állapotát csatornánként, nem pedig globálisan" ,
language _choice _input _received : "Beviteli nyelv a fogadott üzenetekben" ,
language _choice _input _sent : "Írja be a nyelvet az elküldött üzenetekben" ,
language _choice _output _received : "Kimeneti nyelv a fogadott üzenetekben" ,
language _choice _output _sent : "Kimeneti nyelv az elküldött üzenetekben" ,
language _selection _channel : "A nyelvválasztás kifejezetten ehhez a csatornához fog módosulni" ,
language _selection _global : "A nyelv kiválasztása minden szerveren módosul" ,
language _selection _server : "A nyelvválasztás kifejezetten ehhez a szerverhez módosul" ,
2020-12-21 19:56:36 +01:00
popout _translateoption : "fordít" ,
popout _untranslateoption : "Fordítás le" ,
2021-01-26 21:14:48 +01:00
toast _translating : "Fordítás" ,
toast _translating _failed : "Nem sikerült lefordítani" ,
toast _translating _tryanother : "Próbálkozzon másik fordítóval" ,
2022-09-07 13:47:41 +02:00
translate _your _message : "Küldés előtt fordítsa le az üzeneteit" ,
translated _watermark : "lefordított" ,
translator _engine : "Fordító"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "it" : // Italian
2020-09-19 20:49:33 +02:00
return {
2022-09-07 13:47:41 +02:00
backup _engine : "Backup-Traduttore" ,
backup _engine _warning : "Utilizzerà Backup-Traduttore" ,
2020-12-21 19:56:36 +01:00
context _messagetranslateoption : "Traduci messaggio" ,
context _messageuntranslateoption : "Annulla traduzione messaggio" ,
2022-09-07 13:47:41 +02:00
context _translator : "Cerca traduzione" ,
detect _language : "Rileva lingua" ,
error _dailylimit : "Limite di richieste giornaliere raggiunto." ,
error _hourlylimit : "Limite di richiesta oraria raggiunto." ,
error _keyoutdated : "Chiave API obsoleta." ,
error _monthlylimit : "Limite di richieste mensili raggiunto." ,
error _serverdown : "Il server di traduzione potrebbe essere offline." ,
exception _text : "Le parole che iniziano con {{var0}} verranno ignorate" ,
general _addTranslateButton : "Aggiunge un pulsante Traduci all'area di testo del canale" ,
general _sendOriginalMessage : "Invia anche il messaggio originale durante la traduzione del messaggio inviato" ,
general _showOriginalMessage : "Mostra anche il messaggio originale durante la traduzione di un messaggio ricevuto" ,
general _usePerChatTranslation : "Abilita/disabilita lo stato del pulsante Translator per canale e non globalmente" ,
language _choice _input _received : "Lingua di input nei messaggi ricevuti" ,
language _choice _input _sent : "Inserisci la lingua nei tuoi messaggi inviati" ,
language _choice _output _received : "Lingua di output nei messaggi ricevuti" ,
language _choice _output _sent : "Lingua di output nei messaggi inviati" ,
language _selection _channel : "La selezione della lingua verrà modificata in modo specifico per questo canale" ,
language _selection _global : "La selezione della lingua verrà modificata per tutti i server" ,
language _selection _server : "La selezione della lingua verrà modificata in modo specifico per questo server" ,
2020-12-21 19:56:36 +01:00
popout _translateoption : "Tradurre" ,
popout _untranslateoption : "Non tradurre" ,
2021-01-26 21:14:48 +01:00
toast _translating : "Tradurre" ,
toast _translating _failed : "Impossibile tradurre" ,
toast _translating _tryanother : "Prova un altro traduttore" ,
2022-09-07 13:47:41 +02:00
translate _your _message : "Traduci i tuoi messaggi prima di inviarli" ,
translated _watermark : "tradotto" ,
translator _engine : "Traduttore"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "ja" : // Japanese
2020-09-19 20:49:33 +02:00
return {
2022-09-07 13:47:41 +02:00
backup _engine : "バックアップ翻訳者" ,
backup _engine _warning : "バックアップ翻訳者 を使用します" ,
2020-12-21 19:56:36 +01:00
context _messagetranslateoption : "メッセージの翻訳" ,
context _messageuntranslateoption : "メッセージの翻訳解除" ,
2022-09-07 13:47:41 +02:00
context _translator : "翻訳を検索" ,
detect _language : "言語を検出" ,
error _dailylimit : "1 日のリクエスト上限に達しました。" ,
error _hourlylimit : "1 時間あたりのリクエスト制限に達しました。" ,
error _keyoutdated : "API キーが古くなっています。" ,
error _monthlylimit : "月間リクエスト制限に達しました。" ,
error _serverdown : "翻訳サーバーがオフラインになっている可能性があります。" ,
exception _text : "{{var0}} で始まる単語は無視されます" ,
general _addTranslateButton : "チャンネルのテキストエリアに翻訳ボタンを追加します" ,
general _sendOriginalMessage : "送信したメッセージを翻訳するときに元のメッセージも送信します" ,
general _showOriginalMessage : "受信したメッセージを翻訳するときに元のメッセージも表示します" ,
general _usePerChatTranslation : "グローバルではなく、チャネルごとに翻訳者ボタンの状態を有効/無効にします" ,
language _choice _input _received : "受信メッセージの入力言語" ,
language _choice _input _sent : "送信メッセージの入力言語" ,
language _choice _output _received : "受信メッセージの出力言語" ,
language _choice _output _sent : "送信メッセージの出力言語" ,
language _selection _channel : "言語の選択は、このチャンネル専用に変更されます" ,
language _selection _global : "すべてのサーバーの言語選択が変更されます" ,
language _selection _server : "言語の選択は、このサーバー専用に変更されます" ,
2020-12-21 19:56:36 +01:00
popout _translateoption : "翻訳する" ,
popout _untranslateoption : "翻訳しない" ,
2021-01-26 21:14:48 +01:00
toast _translating : "翻訳" ,
toast _translating _failed : "翻訳に失敗しました" ,
toast _translating _tryanother : "別の翻訳者を試す" ,
2022-09-07 13:47:41 +02:00
translate _your _message : "送信する前にメッセージを翻訳する" ,
translated _watermark : "翻訳済み" ,
translator _engine : "翻訳者"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "ko" : // Korean
2020-09-19 20:49:33 +02:00
return {
2022-09-07 13:47:41 +02:00
backup _engine : "백업 번역기" ,
backup _engine _warning : "백업 번역기를 사용합니다" ,
2020-12-21 19:56:36 +01:00
context _messagetranslateoption : "메시지 번역" ,
context _messageuntranslateoption : "메시지 번역 취소" ,
2022-09-07 13:47:41 +02:00
context _translator : "번역 검색" ,
detect _language : "언어를 감지" ,
error _dailylimit : "일일 요청 한도에 도달했습니다." ,
error _hourlylimit : "시간당 요청 한도에 도달했습니다." ,
error _keyoutdated : "API 키가 오래되었습니다." ,
error _monthlylimit : "월간 요청 한도에 도달했습니다." ,
error _serverdown : "번역 서버가 오프라인일 수 있습니다." ,
exception _text : "{{var0}}로 시작하는 단어는 무시됩니다." ,
general _addTranslateButton : "채널 텍스트 영역에 번역 버튼 추가" ,
general _sendOriginalMessage : "또한 보낸 메시지를 번역할 때 원본 메시지를 보냅니다." ,
general _showOriginalMessage : "또한 수신된 메시지를 번역할 때 원본 메시지를 표시합니다." ,
general _usePerChatTranslation : "전역이 아닌 채널별로 번역기 버튼 상태를 활성화/비활성화합니다." ,
language _choice _input _received : "수신된 메시지의 입력 언어" ,
language _choice _input _sent : "보낸 메시지의 입력 언어" ,
language _choice _output _received : "수신된 메시지의 출력 언어" ,
language _choice _output _sent : "보낸 메시지의 출력 언어" ,
language _selection _channel : "이 채널에 대해 특별히 언어 선택이 변경됩니다." ,
language _selection _global : "모든 서버에 대해 언어 선택이 변경됩니다." ,
language _selection _server : "이 서버에 대해 특별히 언어 선택이 변경됩니다." ,
2020-12-21 19:56:36 +01:00
popout _translateoption : "옮기다" ,
popout _untranslateoption : "번역 취소" ,
2021-01-26 21:14:48 +01:00
toast _translating : "번역 중" ,
toast _translating _failed : "번역하지 못했습니다." ,
toast _translating _tryanother : "다른 번역기 시도" ,
2022-09-07 13:47:41 +02:00
translate _your _message : "보내기 전에 메시지 번역" ,
translated _watermark : "번역" ,
translator _engine : "역자"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "lt" : // Lithuanian
2020-09-19 20:49:33 +02:00
return {
2022-09-07 13:47:41 +02:00
backup _engine : "Backup-Vertėjas" ,
backup _engine _warning : "Naudos Backup-Vertėjas" ,
2020-12-21 19:56:36 +01:00
context _messagetranslateoption : "Versti pranešimą" ,
context _messageuntranslateoption : "Išversti pranešimą" ,
2022-09-07 13:47:41 +02:00
context _translator : "Paieškos vertimas" ,
detect _language : "Aptikti kalbą" ,
error _dailylimit : "Pasiektas dienos užklausų limitas." ,
error _hourlylimit : "Pasiektas valandinių užklausų limitas." ,
error _keyoutdated : "API raktas pasenęs." ,
error _monthlylimit : "Pasiektas mėnesio užklausų limitas." ,
error _serverdown : "Vertimo serveris gali būti neprisijungęs." ,
exception _text : "Žodžiai, prasidedantys {{var0}}, bus ignoruojami" ,
general _addTranslateButton : "Prie kanalo teksto srities pridedamas vertimo mygtukas" ,
general _sendOriginalMessage : "Taip pat siunčia originalų pranešimą verčiant jūsų išsiųstą žinutę" ,
general _showOriginalMessage : "Taip pat rodomas pradinis pranešimas, kai verčiamas gautas pranešimas" ,
general _usePerChatTranslation : "Įjungia / išjungia Vertėjo mygtuko būseną kiekvienam kanalui, o ne visame pasaulyje" ,
language _choice _input _received : "Įvesties kalba gautuose pranešimuose" ,
language _choice _input _sent : "Įveskite kalbą siunčiamuose pranešimuose" ,
language _choice _output _received : "Išvesties kalba gautuose pranešimuose" ,
language _choice _output _sent : "Išvesties kalba jūsų išsiųstuose pranešimuose" ,
language _selection _channel : "Kalbos pasirinkimas bus pakeistas specialiai šiam kanalui" ,
language _selection _global : "Kalbos pasirinkimas bus pakeistas visiems serveriams" ,
language _selection _server : "Kalbos pasirinkimas bus pakeistas specialiai šiam serveriui" ,
2020-12-21 19:56:36 +01:00
popout _translateoption : "Išversti" ,
popout _untranslateoption : "Neišversti" ,
2021-01-26 21:14:48 +01:00
toast _translating : "Vertimas" ,
toast _translating _failed : "Nepavyko išversti" ,
toast _translating _tryanother : "Išbandykite kitą vertėją" ,
2022-09-07 13:47:41 +02:00
translate _your _message : "Prieš siųsdami išverskite savo pranešimus" ,
translated _watermark : "išverstas" ,
translator _engine : "Vertėjas"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "nl" : // Dutch
2020-09-19 20:49:33 +02:00
return {
2022-09-07 13:47:41 +02:00
backup _engine : "Backup-Vertaler" ,
backup _engine _warning : "Zal Backup-Vertaler gebruiken" ,
2020-12-21 19:56:36 +01:00
context _messagetranslateoption : "Bericht vertalen" ,
context _messageuntranslateoption : "Bericht onvertalen" ,
2022-09-07 13:47:41 +02:00
context _translator : "Zoek vertaling" ,
detect _language : "Taal detecteren" ,
error _dailylimit : "Dagelijkse verzoeklimiet bereikt." ,
error _hourlylimit : "Verzoeklimiet per uur bereikt." ,
error _keyoutdated : "API-sleutel verouderd." ,
error _monthlylimit : "Maandelijkse aanvraaglimiet bereikt." ,
error _serverdown : "Vertaalserver is mogelijk offline." ,
exception _text : "Woorden die beginnen met {{var0}} worden genegeerd" ,
general _addTranslateButton : "Voegt een vertaalknop toe aan het kanaaltekstgebied" ,
general _sendOriginalMessage : "Verzendt ook het originele bericht bij het vertalen van uw verzonden bericht" ,
general _showOriginalMessage : "Toont ook het originele bericht bij het vertalen van een ontvangen bericht" ,
general _usePerChatTranslation : "Schakelt de status van de vertaalknop in/uit per kanaal en niet globaal" ,
language _choice _input _received : "Invoertaal in ontvangen berichten" ,
language _choice _input _sent : "Invoertaal in uw verzonden berichten" ,
language _choice _output _received : "Uitvoertaal in ontvangen berichten" ,
language _choice _output _sent : "Uitvoertaal in uw verzonden berichten" ,
language _selection _channel : "De taalselectie wordt specifiek voor dit kanaal gewijzigd" ,
language _selection _global : "Taalkeuze wordt voor alle servers gewijzigd" ,
language _selection _server : "Taalselectie wordt specifiek voor deze server gewijzigd" ,
2020-12-21 19:56:36 +01:00
popout _translateoption : "Vertalen" ,
popout _untranslateoption : "Onvertalen" ,
2021-01-26 21:14:48 +01:00
toast _translating : "Vertalen" ,
toast _translating _failed : "Kan niet vertalen" ,
toast _translating _tryanother : "Probeer een andere vertaler" ,
2022-09-07 13:47:41 +02:00
translate _your _message : "Vertaal uw berichten voordat u ze verzendt" ,
translated _watermark : "vertaald" ,
translator _engine : "Vertaler"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "no" : // Norwegian
2020-09-19 20:49:33 +02:00
return {
2022-09-07 13:47:41 +02:00
backup _engine : "Backup-Oversetter" ,
backup _engine _warning : "Vil bruke Backup-Oversetter" ,
2020-12-21 19:56:36 +01:00
context _messagetranslateoption : "Oversett melding" ,
context _messageuntranslateoption : "Ikke oversett melding" ,
2022-09-07 13:47:41 +02:00
context _translator : "Søk i oversettelse" ,
detect _language : "Oppdage språk" ,
error _dailylimit : "Daglig forespørselsgrense nådd." ,
error _hourlylimit : "Forespørselsgrensen for time nådd." ,
error _keyoutdated : "API-nøkkel utdatert." ,
error _monthlylimit : "Månedlig forespørselsgrense nådd." ,
error _serverdown : "Oversettelsesserveren kan være frakoblet." ,
exception _text : "Ord som begynner med {{var0}} vil bli ignorert" ,
general _addTranslateButton : "Legger til en oversettknapp til kanaltekstområdet" ,
general _sendOriginalMessage : "Sender også den originale meldingen når du oversetter den sendte meldingen" ,
general _showOriginalMessage : "Viser også den originale meldingen når du oversetter en mottatt melding" ,
general _usePerChatTranslation : "Aktiverer/deaktiverer oversetterknappens tilstand per kanal og ikke globalt" ,
language _choice _input _received : "Inndataspråk i mottatte meldinger" ,
language _choice _input _sent : "Inntastingsspråk i sendte meldinger" ,
language _choice _output _received : "Utdataspråk i mottatte meldinger" ,
language _choice _output _sent : "Utdataspråk i dine sendte meldinger" ,
language _selection _channel : "Språkvalg vil bli endret spesifikt for denne kanalen" ,
language _selection _global : "Språkvalg vil bli endret for alle servere" ,
language _selection _server : "Språkvalg vil bli endret spesifikt for denne serveren" ,
2020-12-21 19:56:36 +01:00
popout _translateoption : "Oversette" ,
popout _untranslateoption : "Ikke oversett" ,
2021-01-26 21:14:48 +01:00
toast _translating : "Oversetter" ,
toast _translating _failed : "Kunne ikke oversette" ,
toast _translating _tryanother : "Prøv en annen oversetter" ,
2022-09-07 13:47:41 +02:00
translate _your _message : "Oversett meldingene dine før sending" ,
translated _watermark : "oversatt" ,
translator _engine : "Oversetter"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "pl" : // Polish
2020-09-19 20:49:33 +02:00
return {
2022-09-07 13:47:41 +02:00
backup _engine : "Backup-Tłumacz" ,
backup _engine _warning : "Użyje Backup-Tłumacz" ,
2020-12-21 19:56:36 +01:00
context _messagetranslateoption : "Przetłumacz wiadomość" ,
context _messageuntranslateoption : "Nieprzetłumacz wiadomość" ,
2022-09-07 13:47:41 +02:00
context _translator : "Wyszukaj tłumaczenie" ,
detect _language : "Wykryj język" ,
error _dailylimit : "Osiągnięto dzienny limit żądań." ,
error _hourlylimit : "Osiągnięto godzinowy limit żądań." ,
error _keyoutdated : "Klucz API jest nieaktualny." ,
error _monthlylimit : "Osiągnięto miesięczny limit żądań." ,
error _serverdown : "Serwer tłumaczeń może być w trybie offline." ,
exception _text : "Słowa zaczynające się od {{var0}} będą ignorowane" ,
general _addTranslateButton : "Dodaje przycisk Tłumacz do obszaru tekstowego kanału" ,
general _sendOriginalMessage : "Wysyła również oryginalną wiadomość podczas tłumaczenia wysłanej wiadomości" ,
general _showOriginalMessage : "Pokazuje również oryginalną wiadomość podczas tłumaczenia otrzymanej wiadomości" ,
general _usePerChatTranslation : "Włącza/wyłącza stan przycisku translatora na kanał, a nie globalnie" ,
language _choice _input _received : "Język wprowadzania w odebranych wiadomościach" ,
language _choice _input _sent : "Język wprowadzania w wysyłanych wiadomościach" ,
language _choice _output _received : "Język wyjściowy w odebranych wiadomościach" ,
language _choice _output _sent : "Język wyjściowy w wysłanych wiadomościach" ,
language _selection _channel : "Wybór języka zostanie zmieniony specjalnie dla tego kanału" ,
language _selection _global : "Wybór języka zostanie zmieniony dla wszystkich serwerów" ,
language _selection _server : "Wybór języka zostanie zmieniony specjalnie dla tego serwera" ,
2020-12-21 19:56:36 +01:00
popout _translateoption : "Tłumaczyć" ,
popout _untranslateoption : "Nie przetłumacz" ,
2021-01-26 21:14:48 +01:00
toast _translating : "Tłumaczenie" ,
toast _translating _failed : "Nie udało się przetłumaczyć" ,
toast _translating _tryanother : "Wypróbuj innego tłumacza" ,
2022-09-07 13:47:41 +02:00
translate _your _message : "Przetłumacz swoje wiadomości przed wysłaniem" ,
translated _watermark : "przetłumaczony" ,
translator _engine : "Tłumacz"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "pt-BR" : // Portuguese (Brazil)
2020-09-19 20:49:33 +02:00
return {
2022-09-07 13:47:41 +02:00
backup _engine : "Backup-Tradutor" ,
backup _engine _warning : "Usará o Backup-Tradutor" ,
2020-12-21 19:56:36 +01:00
context _messagetranslateoption : "Traduzir mensagem" ,
context _messageuntranslateoption : "Mensagem não traduzida" ,
2022-09-07 13:47:41 +02:00
context _translator : "Tradução de pesquisa" ,
detect _language : "Detectar idioma" ,
error _dailylimit : "Limite de solicitações diárias atingido." ,
error _hourlylimit : "Limite de solicitação por hora atingido." ,
error _keyoutdated : "Chave de API desatualizada." ,
error _monthlylimit : "Limite de solicitação mensal atingido." ,
error _serverdown : "O servidor de tradução pode estar offline." ,
exception _text : "Palavras que começam com {{var0}} serão ignoradas" ,
general _addTranslateButton : "Adiciona um botão de tradução à área de texto do canal" ,
general _sendOriginalMessage : "Também envia a Mensagem original ao traduzir sua Mensagem enviada" ,
general _showOriginalMessage : "Também mostra a Mensagem original ao traduzir uma Mensagem recebida" ,
general _usePerChatTranslation : "Habilita/desabilita o estado do botão do tradutor por canal e não globalmente" ,
language _choice _input _received : "Idioma de entrada nas mensagens recebidas" ,
language _choice _input _sent : "Idioma de entrada em suas mensagens enviadas" ,
language _choice _output _received : "Idioma de saída nas mensagens recebidas" ,
language _choice _output _sent : "Idioma de saída em suas mensagens enviadas" ,
language _selection _channel : "A seleção de idioma será alterada especificamente para este canal" ,
language _selection _global : "A seleção de idioma será alterada para todos os servidores" ,
language _selection _server : "A seleção de idioma será alterada especificamente para este servidor" ,
2020-12-21 19:56:36 +01:00
popout _translateoption : "Traduzir" ,
popout _untranslateoption : "Não traduzido" ,
2021-01-26 21:14:48 +01:00
toast _translating : "Traduzindo" ,
toast _translating _failed : "Falha ao traduzir" ,
toast _translating _tryanother : "Tente outro tradutor" ,
2022-09-07 13:47:41 +02:00
translate _your _message : "Traduza suas mensagens antes de enviar" ,
translated _watermark : "traduzido" ,
translator _engine : "Tradutor"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "ro" : // Romanian
2020-09-19 20:49:33 +02:00
return {
2022-09-07 13:47:41 +02:00
backup _engine : "Backup-Traducător" ,
backup _engine _warning : "Va folosi Backup-Traducător" ,
2020-12-21 19:56:36 +01:00
context _messagetranslateoption : "Traduceți mesajul" ,
context _messageuntranslateoption : "Untraduceți mesajul" ,
2022-09-07 13:47:41 +02:00
context _translator : "Căutare traducere" ,
detect _language : "Detecteaza limba" ,
error _dailylimit : "Limita zilnică de solicitare a fost atinsă." ,
error _hourlylimit : "Limita orară de solicitare a fost atinsă." ,
error _keyoutdated : "API-Key este învechită." ,
error _monthlylimit : "Limita lunară de solicitare a fost atinsă." ,
error _serverdown : "Serverul de traducere ar putea fi offline." ,
exception _text : "Cuvintele care încep cu {{var0}} vor fi ignorate" ,
general _addTranslateButton : "Adaugă un buton de traducere în zona de text a canalului" ,
general _sendOriginalMessage : "De asemenea, trimite mesajul original atunci când traduceți mesajul trimis" ,
general _showOriginalMessage : "Afișează, de asemenea, mesajul original atunci când traduceți un mesaj primit" ,
general _usePerChatTranslation : "Activează/dezactivează starea butonului de traducător pe canal și nu la nivel global" ,
language _choice _input _received : "Limba de intrare în mesajele primite" ,
language _choice _input _sent : "Introduceți limba în mesajele trimise" ,
language _choice _output _received : "Limba de ieșire în mesajele primite" ,
language _choice _output _sent : "Limba de ieșire în mesajele trimise" ,
language _selection _channel : "Selectarea limbii va fi modificată special pentru acest canal" ,
language _selection _global : "Selectarea limbii va fi modificată pentru toate serverele" ,
language _selection _server : "Selectarea limbii va fi modificată special pentru acest Server" ,
2020-12-21 19:56:36 +01:00
popout _translateoption : "Traduceți" ,
popout _untranslateoption : "Netradus" ,
2021-01-26 21:14:48 +01:00
toast _translating : "Traducere" ,
toast _translating _failed : "Nu s-a putut traduce" ,
toast _translating _tryanother : "Încercați un alt traducător" ,
2022-09-07 13:47:41 +02:00
translate _your _message : "Traduceți mesajele înainte de a le trimite" ,
translated _watermark : "tradus" ,
translator _engine : "Traducător"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "ru" : // Russian
2020-09-19 20:49:33 +02:00
return {
2022-09-07 13:47:41 +02:00
backup _engine : "Резервный-Переводчик" ,
backup _engine _warning : "Буду использовать Резервный-Переводчик" ,
2020-12-21 19:56:36 +01:00
context _messagetranslateoption : "Перевести сообщение" ,
context _messageuntranslateoption : "Непереведенное сообщение" ,
2022-09-07 13:47:41 +02:00
context _translator : "Искать перевод" ,
detect _language : "Определить язык" ,
error _dailylimit : "Достигнут дневной лимит запросов." ,
error _hourlylimit : "Достигнут лимит почасовых запросов." ,
error _keyoutdated : "API-ключ устарел." ,
error _monthlylimit : "Достигнут месячный лимит запросов." ,
error _serverdown : "Сервер переводов может быть отключен." ,
exception _text : "Слова, начинающиеся с {{var0}}, будут игнорироваться." ,
general _addTranslateButton : "Добавляет кнопку перевода в текстовую область канала" ,
general _sendOriginalMessage : "Также отправляет исходное сообщение при переводе отправленного сообщения." ,
general _showOriginalMessage : "Также показывает исходное сообщение при переводе полученного сообщения." ,
general _usePerChatTranslation : "Включает/отключает состояние кнопки переводчика для каждого канала, а не глобально" ,
language _choice _input _received : "Язык ввода в полученных сообщениях" ,
language _choice _input _sent : "Язык ввода в ваших отправленных сообщениях" ,
language _choice _output _received : "Язык вывода в полученных сообщениях" ,
language _choice _output _sent : "Язык вывода в ваших отправленных сообщениях" ,
language _selection _channel : "Выбор языка будет изменен специально для этого канала." ,
language _selection _global : "Выбор языка будет изменен для всех серверов." ,
language _selection _server : "Выбор языка будет изменен специально для этого сервера" ,
2020-12-21 19:56:36 +01:00
popout _translateoption : "Переведите" ,
popout _untranslateoption : "Неперевести" ,
2021-01-26 21:14:48 +01:00
toast _translating : "Идет перевод" ,
toast _translating _failed : "Н е удалось перевести" ,
toast _translating _tryanother : "Попробуйте другой переводчик" ,
2022-09-07 13:47:41 +02:00
translate _your _message : "Переводите свои сообщения перед отправкой" ,
translated _watermark : "переведено" ,
translator _engine : "Переводчик"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "sv" : // Swedish
2020-09-19 20:49:33 +02:00
return {
2022-09-07 13:47:41 +02:00
backup _engine : "Backup-Översättare" ,
backup _engine _warning : "Kommer att använda Backup-Översättare" ,
2020-12-21 19:56:36 +01:00
context _messagetranslateoption : "Översätt meddelande" ,
context _messageuntranslateoption : "Untranslate meddelande" ,
2022-09-07 13:47:41 +02:00
context _translator : "Sök översättning" ,
detect _language : "Upptäck språk" ,
error _dailylimit : "Daglig förfrågningsgräns nådd." ,
error _hourlylimit : "Begäran per timme nådd." ,
error _keyoutdated : "API-nyckel föråldrad." ,
error _monthlylimit : "Gränsen för månatlig begäran har nåtts." ,
error _serverdown : "Översättningsservern kan vara offline." ,
exception _text : "Ord som börjar med {{var0}} kommer att ignoreras" ,
general _addTranslateButton : "Lägger till en Översätt-knapp i kanaltextområdet" ,
general _sendOriginalMessage : "Skickar också det ursprungliga meddelandet när du översätter ditt skickade meddelande" ,
general _showOriginalMessage : "Visar även det ursprungliga meddelandet när ett mottaget meddelande översätts" ,
general _usePerChatTranslation : "Aktiverar/inaktiverar översättarknappens status per kanal och inte globalt" ,
language _choice _input _received : "Inmatningsspråk i mottagna meddelanden" ,
language _choice _input _sent : "Inmatningsspråk i dina skickade meddelanden" ,
language _choice _output _received : "Utmatningsspråk i mottagna meddelanden" ,
language _choice _output _sent : "Utmatningsspråk i dina skickade meddelanden" ,
language _selection _channel : "Språkval kommer att ändras specifikt för denna kanal" ,
language _selection _global : "Språkval kommer att ändras för alla servrar" ,
language _selection _server : "Språkval kommer att ändras specifikt för denna server" ,
2020-12-21 19:56:36 +01:00
popout _translateoption : "Översätt" ,
popout _untranslateoption : "Untranslate" ,
2021-01-26 21:14:48 +01:00
toast _translating : "Översätter" ,
toast _translating _failed : "Det gick inte att översätta" ,
toast _translating _tryanother : "Prova en annan översättare" ,
2022-09-07 13:47:41 +02:00
translate _your _message : "Översätt dina meddelanden innan du skickar" ,
translated _watermark : "översatt" ,
translator _engine : "Översättare"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "th" : // Thai
2020-09-19 20:49:33 +02:00
return {
2022-09-07 13:47:41 +02:00
backup _engine : "สำรอง-นักแปล" ,
backup _engine _warning : "จะใช้การสำรองข้อมูล-นักแปล" ,
2020-12-21 19:56:36 +01:00
context _messagetranslateoption : "แปลข้อความ" ,
context _messageuntranslateoption : "ยกเลิกการแปลข้อความ" ,
2022-09-07 13:47:41 +02:00
context _translator : "ค้นหาคำแปล" ,
detect _language : "ตรวจจับภาษา" ,
error _dailylimit : "ถึงขีดจำกัดคำขอรายวันแล้ว" ,
error _hourlylimit : "ถึงขีดจำกัดคำขอรายชั่วโมงแล้ว" ,
error _keyoutdated : "API-Key ล้าสมัยแล้ว" ,
error _monthlylimit : "ถึงขีดจำกัดคำขอรายเดือนแล้ว" ,
error _serverdown : "เซิร์ฟเวอร์การแปลอาจออฟไลน์อยู่" ,
exception _text : "คำที่ขึ้นต้นด้วย {{var0}} จะถูกละเว้น" ,
general _addTranslateButton : "เพิ่มปุ่มแปลภาษาไปยัง Textarea ของช่อง" ,
general _sendOriginalMessage : "ส่งข้อความต้นฉบับเมื่อแปลข้อความที่ส่งของคุณ" ,
general _showOriginalMessage : "ยังแสดงข้อความต้นฉบับเมื่อแปลข้อความที่ได้รับ" ,
general _usePerChatTranslation : "เปิด/ปิดสถานะปุ่มนักแปลต่อช่องและไม่ใช่ทั่วโลก" ,
language _choice _input _received : "ป้อนภาษาในข้อความที่ได้รับ" ,
language _choice _input _sent : "ป้อนภาษาในข้อความที่คุณส่ง" ,
language _choice _output _received : "ภาษาเอาต์พุตในข้อความที่ได้รับ" ,
language _choice _output _sent : "ภาษาที่ส่งออกในข้อความที่ส่งของคุณ" ,
language _selection _channel : "การเลือกภาษาจะมีการเปลี่ยนแปลงเฉพาะสำหรับช่องนี้" ,
language _selection _global : "การเลือกภาษาจะมีการเปลี่ยนแปลงสำหรับเซิร์ฟเวอร์ทั้งหมด" ,
language _selection _server : "การเลือกภาษาจะมีการเปลี่ยนแปลงโดยเฉพาะสำหรับเซิร์ฟเวอร์นี้" ,
2020-12-21 19:56:36 +01:00
popout _translateoption : "แปลภาษา" ,
popout _untranslateoption : "ไม่แปล" ,
2021-01-26 21:14:48 +01:00
toast _translating : "กำลังแปล" ,
toast _translating _failed : "แปลไม่สำเร็จ" ,
toast _translating _tryanother : "ลองใช้นักแปลคนอื่น" ,
2022-09-07 13:47:41 +02:00
translate _your _message : "แปลข้อความของคุณก่อนส่ง" ,
translated _watermark : "แปล" ,
translator _engine : "นักแปล"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "tr" : // Turkish
2020-09-19 20:49:33 +02:00
return {
2022-09-07 13:47:41 +02:00
backup _engine : "Yedekleme-Çevirmen" ,
backup _engine _warning : "Yedekleme-Çevirmen kullanacak" ,
2020-12-21 19:56:36 +01:00
context _messagetranslateoption : "Mesajı Çevir" ,
context _messageuntranslateoption : "Çeviriyi Kaldı r Mesajı " ,
2022-09-07 13:47:41 +02:00
context _translator : "Çeviri ara" ,
detect _language : "Dili Algı la" ,
error _dailylimit : "Günlük İstek Sı nı rı na ulaşı ldı ." ,
error _hourlylimit : "Saatlik İstek Sı nı rı na ulaşı ldı ." ,
error _keyoutdated : "API Anahtarı güncel değil." ,
error _monthlylimit : "Aylı k İstek Sı nı rı na ulaşı ldı ." ,
error _serverdown : "Çeviri Sunucusu çevrimdı şı olabilir." ,
exception _text : "{{var0}} ile başlayan kelimeler yok sayı lacak" ,
general _addTranslateButton : "Kanal Metin Alanı na Çevir Düğmesi Ekler" ,
general _sendOriginalMessage : "Gönderilen Mesajı nı zı çevirirken orijinal Mesajı da gönderir" ,
general _showOriginalMessage : "Alı nan bir Mesajı tercüme ederken orijinal Mesajı da gösterir." ,
general _usePerChatTranslation : "Genel olarak değil, Kanal başı na Çevirmen Düğmesi Durumunu Etkinleştirir/Devre Dı şı Bı rakı r" ,
language _choice _input _received : "Alı nan Mesajlarda Giriş Dili" ,
language _choice _input _sent : "Gönderilen Mesajları nı zda Dil Girin" ,
language _choice _output _received : "Alı nan Mesajlarda Çı ktı Dili" ,
language _choice _output _sent : "Gönderilen Mesajları nı zda Çı ktı Dili" ,
language _selection _channel : "Dil Seçimi bu Kanal için özel olarak değiştirilecektir." ,
language _selection _global : "Tüm Sunucular için Dil Seçimi değiştirilecek" ,
language _selection _server : "Dil Seçimi bu Sunucuya özel olarak değiştirilecektir." ,
2020-12-21 19:56:36 +01:00
popout _translateoption : "Çevirmek" ,
popout _untranslateoption : "Çevirmeyi kaldı r" ,
2021-01-26 21:14:48 +01:00
toast _translating : "Çeviri" ,
toast _translating _failed : "Tercüme edilemedi" ,
toast _translating _tryanother : "Başka bir Çevirmen deneyin" ,
2022-09-07 13:47:41 +02:00
translate _your _message : "Göndermeden önce Mesajları nı zı çevirin" ,
translated _watermark : "tercüme" ,
translator _engine : "Çevirmen"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "uk" : // Ukrainian
2020-09-19 20:49:33 +02:00
return {
2022-09-07 13:47:41 +02:00
backup _engine : "Резервний-перекладач" ,
backup _engine _warning : "Використовуватиме Резервний-Перекладач" ,
2020-12-21 19:56:36 +01:00
context _messagetranslateoption : "Перекласти повідомлення" ,
context _messageuntranslateoption : "Неперекладене повідомлення" ,
2022-09-07 13:47:41 +02:00
context _translator : "Пошук перекладу" ,
detect _language : "Визначити мову" ,
error _dailylimit : "Денний ліміт запитів досягнуто." ,
error _hourlylimit : "Досягнуто погодинного ліміту запитів." ,
error _keyoutdated : "API-ключ застарів." ,
error _monthlylimit : "Досягнуто місячного ліміту запитів." ,
error _serverdown : "Сервер перекладу може бути офлайн." ,
exception _text : "Слова, що починаються з {{var0}}, ігноруватимуться" ,
general _addTranslateButton : "Додає кнопку перекладу до текстової області каналу" ,
general _sendOriginalMessage : "Також надсилає оригінальне повідомлення під час перекладу вашого надісланого повідомлення" ,
general _showOriginalMessage : "Також показує оригінальне повідомлення під час перекладу отриманого повідомлення" ,
general _usePerChatTranslation : "Вмикає/вимикає стан кнопки перекладача для кожного каналу, а не глобально" ,
language _choice _input _received : "Мова введення в отриманих повідомленнях" ,
language _choice _input _sent : "Мова введення у ваших надісланих повідомленнях" ,
language _choice _output _received : "Мова виводу в отриманих повідомленнях" ,
language _choice _output _sent : "Мова виведення у ваших надісланих повідомленнях" ,
language _selection _channel : "Вибір мови буде змінено спеціально для цього каналу" ,
language _selection _global : "Вибір мови буде змінено для всіх серверів" ,
language _selection _server : "Вибір мови буде змінено спеціально для цього сервера" ,
2020-12-21 19:56:36 +01:00
popout _translateoption : "Перекласти" ,
popout _untranslateoption : "Неперекласти" ,
2021-01-26 21:14:48 +01:00
toast _translating : "Переклад" ,
toast _translating _failed : "Н е вдалося перекласти" ,
toast _translating _tryanother : "Спробуйте іншого перекладача" ,
2022-09-07 13:47:41 +02:00
translate _your _message : "Перекладіть свої повідомлення перед надсиланням" ,
translated _watermark : "переклав" ,
translator _engine : "Перекладач"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
case "vi" : // Vietnamese
2020-09-19 20:49:33 +02:00
return {
2022-09-07 13:47:41 +02:00
backup _engine : "Backup-Gười phiên dịch" ,
backup _engine _warning : "Sẽ sử dụng Backup-Gười phiên dịch" ,
2020-12-21 19:56:36 +01:00
context _messagetranslateoption : "Dịch tin nhắn" ,
context _messageuntranslateoption : "Thư chưa dịch" ,
2022-09-07 13:47:41 +02:00
context _translator : "Tìm kiếm bản dịch" ,
detect _language : "Phát hiện ngôn ngữ" ,
error _dailylimit : "Đã đạt đến Giới hạn Yêu cầu Hàng ngày." ,
error _hourlylimit : "Đã đạt đến Giới hạn Yêu cầu Hàng giờ." ,
error _keyoutdated : "API-Key đã lỗi thời." ,
error _monthlylimit : "Đã đạt đến Giới hạn Yêu cầu Hàng tháng." ,
error _serverdown : "Máy chủ dịch có thể ngoại tuyến." ,
exception _text : "Các từ bắt đầu bằng {{var0}} sẽ bị bỏ qua" ,
general _addTranslateButton : "Thêm nút dịch vào vùng văn bản của kênh" ,
general _sendOriginalMessage : "Đồng thời gửi Tin nhắn gốc khi dịch Tin nhắn đã gửi của bạn" ,
general _showOriginalMessage : "Đồng thời hiển thị Tin nhắn gốc khi dịch một Tin nhắn đã nhận" ,
general _usePerChatTranslation : "Bật / tắt Trạng thái nút dịch trên mỗi kênh và không bật trên toàn cầu" ,
language _choice _input _received : "Nhập Ngôn ngữ trong Tin nhắn đã nhận" ,
language _choice _input _sent : "Nhập Ngôn ngữ trong Tin nhắn đã gửi của bạn" ,
language _choice _output _received : "Ngôn ngữ đầu ra trong Tin nhắn đã nhận" ,
language _choice _output _sent : "Ngôn ngữ đầu ra trong Tin nhắn đã gửi của bạn" ,
language _selection _channel : "Lựa chọn ngôn ngữ sẽ được thay đổi cụ thể cho Kênh này" ,
language _selection _global : "Lựa chọn ngôn ngữ sẽ được thay đổi cho tất cả các Máy chủ" ,
language _selection _server : "Lựa chọn ngôn ngữ sẽ được thay đổi cụ thể cho Máy chủ này" ,
2020-12-21 19:56:36 +01:00
popout _translateoption : "Phiên dịch" ,
popout _untranslateoption : "Chưa dịch" ,
2021-01-26 21:14:48 +01:00
toast _translating : "Phiên dịch" ,
toast _translating _failed : "Không dịch được" ,
toast _translating _tryanother : "Thử một Trình dịch khác" ,
2022-09-07 13:47:41 +02:00
translate _your _message : "Dịch Tin nhắn của bạn trước khi gửi" ,
translated _watermark : "đã dịch" ,
translator _engine : "Người phiên dịch"
2020-09-19 20:49:33 +02:00
} ;
2021-01-15 17:54:22 +01:00
case "zh-CN" : // Chinese (China)
2020-09-19 20:49:33 +02:00
return {
2022-09-07 13:47:41 +02:00
backup _engine : "备份翻译器" ,
backup _engine _warning : "将使用备份翻译器" ,
2021-01-15 17:56:14 +01:00
context _messagetranslateoption : "翻译消息" ,
context _messageuntranslateoption : "取消翻译消息" ,
2022-09-07 13:47:41 +02:00
context _translator : "搜索翻译" ,
detect _language : "检测语言" ,
error _dailylimit : "已达到每日请求限制。" ,
error _hourlylimit : "已达到每小时请求限制。" ,
error _keyoutdated : "API 密钥已过时。" ,
error _monthlylimit : "已达到每月请求限制。" ,
error _serverdown : "翻译服务器可能离线。" ,
exception _text : "以 {{var0}} 开头的单词将被忽略" ,
general _addTranslateButton : "将翻译按钮添加到频道文本区域" ,
general _sendOriginalMessage : "翻译您发送的消息时也会发送原始消息" ,
general _showOriginalMessage : "翻译收到的消息时还显示原始消息" ,
general _usePerChatTranslation : "启用/禁用每个通道而不是全局的转换器按钮状态" ,
language _choice _input _received : "收到消息中的输入语言" ,
language _choice _input _sent : "在您发送的消息中输入语言" ,
language _choice _output _received : "接收消息中的输出语言" ,
language _choice _output _sent : "您发送的消息中的输出语言" ,
language _selection _channel : "将专门为此频道更改语言选择" ,
language _selection _global : "将更改所有服务器的语言选择" ,
language _selection _server : "语言选择将专门为此服务器更改" ,
2020-12-21 19:56:36 +01:00
popout _translateoption : "翻译" ,
popout _untranslateoption : "取消翻译" ,
2021-01-26 21:14:48 +01:00
toast _translating : "正在翻译" ,
toast _translating _failed : "翻译失败" ,
2021-12-15 21:44:54 +01:00
toast _translating _tryanother : "尝试其它翻译器" ,
2022-09-07 13:47:41 +02:00
translate _your _message : "发送前翻译您的消息" ,
translated _watermark : "已翻译" ,
translator _engine : "译者"
2020-09-19 20:49:33 +02:00
} ;
2021-01-15 17:54:22 +01:00
case "zh-TW" : // Chinese (Taiwan)
2020-09-19 20:49:33 +02:00
return {
2022-09-07 13:47:41 +02:00
backup _engine : "備份翻譯器" ,
backup _engine _warning : "將使用備份翻譯器" ,
2020-12-21 19:56:36 +01:00
context _messagetranslateoption : "翻譯訊息" ,
2021-01-15 17:54:22 +01:00
context _messageuntranslateoption : "取消翻譯訊息" ,
2022-09-07 13:47:41 +02:00
context _translator : "搜尋翻譯" ,
detect _language : "檢測語言" ,
error _dailylimit : "已達到每日請求限制。" ,
error _hourlylimit : "已達到每小時請求限制。" ,
error _keyoutdated : "API 密鑰已過時。" ,
error _monthlylimit : "已達到每月請求限制。" ,
error _serverdown : "翻譯服務器可能離線。" ,
exception _text : "以 {{var0}} 開頭的單詞將被忽略" ,
general _addTranslateButton : "將翻譯按鈕添加到頻道文本區域" ,
general _sendOriginalMessage : "翻譯您發送的消息時也會發送原始消息" ,
general _showOriginalMessage : "翻譯收到的消息時還顯示原始消息" ,
general _usePerChatTranslation : "啟用/禁用每個通道而不是全局的轉換器按鈕狀態" ,
language _choice _input _received : "收到消息中的輸入語言" ,
language _choice _input _sent : "在您發送的消息中輸入語言" ,
language _choice _output _received : "接收消息中的輸出語言" ,
language _choice _output _sent : "您發送的消息中的輸出語言" ,
language _selection _channel : "將專門為此頻道更改語言選擇" ,
language _selection _global : "將更改所有服務器的語言選擇" ,
language _selection _server : "語言選擇將專門為此服務器更改" ,
2020-12-21 19:56:36 +01:00
popout _translateoption : "翻譯" ,
popout _untranslateoption : "取消翻譯" ,
2021-01-26 21:14:48 +01:00
toast _translating : "正在翻譯" ,
2021-12-15 21:44:54 +01:00
toast _translating _failed : "無法翻譯" ,
toast _translating _tryanother : "嘗試其它翻譯器" ,
2022-09-07 13:47:41 +02:00
translate _your _message : "發送前翻譯您的消息" ,
translated _watermark : "已翻譯" ,
translator _engine : "譯者"
2020-09-19 20:49:33 +02:00
} ;
2020-12-21 19:56:36 +01:00
default : // English
2020-09-19 20:49:33 +02:00
return {
2022-09-07 13:47:41 +02:00
backup _engine : "Backup-Translator" ,
backup _engine _warning : "Will use Backup-Translator" ,
2020-12-21 19:56:36 +01:00
context _messagetranslateoption : "Translate Message" ,
context _messageuntranslateoption : "Untranslate Message" ,
2022-09-07 13:47:41 +02:00
context _translator : "Search Translation" ,
detect _language : "Detect Language" ,
error _dailylimit : "Daily Request Limit reached." ,
error _hourlylimit : "Hourly Request Limit reached." ,
error _keyoutdated : "API-Key outdated." ,
error _monthlylimit : "Monthly Request Limit reached." ,
error _serverdown : "Translation Server might be offline." ,
exception _text : "Words starting with {{var0}} will be ignored" ,
general _addTranslateButton : "Adds a Translate Button to the Channel Textarea" ,
general _sendOriginalMessage : "Also sends the original Message when translating your sent Message" ,
general _showOriginalMessage : "Also shows the original Message when translating a received Message" ,
general _usePerChatTranslation : "Enables/Disables the Translator Button State per Channel and not globally" ,
language _choice _input _received : "Input Language in received Messages" ,
language _choice _input _sent : "Input Language in your sent Messages" ,
language _choice _output _received : "Output Language in received Messages" ,
language _choice _output _sent : "Output Language in your sent Messages" ,
language _selection _channel : "Language Selection will be changed specifically for this Channel" ,
language _selection _global : "Language Selection will be changed for all Servers" ,
language _selection _server : "Language Selection will be changed specifically for this Server" ,
2020-12-21 19:56:36 +01:00
popout _translateoption : "Translate" ,
popout _untranslateoption : "Untranslate" ,
2021-01-26 21:14:48 +01:00
toast _translating : "Translating" ,
toast _translating _failed : "Failed to translate" ,
toast _translating _tryanother : "Try another Translator" ,
2022-09-07 13:47:41 +02:00
translate _your _message : "Translate your Messages before sending" ,
translated _watermark : "translated" ,
translator _engine : "Translator"
2020-09-19 20:49:33 +02:00
} ;
}
}
} ;
2022-09-01 14:40:11 +02:00
} ) ( window . BDFDB _Global . PluginUtils . buildPlugin ( changeLog ) ) ;
2023-04-19 10:39:58 +02:00
} ) ( ) ;