translate

Privateunrated

Content

110 lines
{=(COMMENT):You can set the embed color to be a hex color code (#7289DA, #123456) or you can put "random" if you want it to be a random color. If the hex color code is invalid, the embed color will just be grey.}
{=(embedcolor):random}

{=(COMMENT):Set the prefix you use for the bot in your server!}
{=(prefix):!}

{=(COMMENT):The rest is just code, you don't have to do anything.}

{=(COMMENT):DO NOT TOUCH! The lists below are used later to convert each language to it's language code (necessary for the Google Translate link) and the order matters!}
{=(langs):Detect_Language Afrikaans Irish Albanian Italian Arabic Japanese Azerbaijani Kannada Basque Korean Bengali Latin Belarusian Latvian Bulgarian Lithuanian Catalan Macedonian Chinese_Simplified Malay Chinese_Traditional Maltese Croatian Norwegian Czech Persian Danish Polish Dutch Portuguese English Romanian Esperanto Russian Estonian Serbian Filipino Slovak Finnish Slovenian French Spanish Galician Swahili Georgian Swedish German Tamil Greek Telugu Gujarati Thai Haitian_Creole Turkish Hebrew Ukrainian Hindi Urdu Hungarian Vietnamese Icelandic Welsh Indonesian Yiddish error}
{=(abbrevs):auto,af,ga,sq,it,ar,ja,az,kn,eu,ko,bn,la,be,lv,bg,lt,ca,mk,zh-CN,ms,zh-TW,mt,hr,no,cs,fa,da,pl,nl,pt,en,ro,eo,ru,et,sr,tl,sk,fi,sl,fr,es,gl,sw,ka,sv,de,ta,el,te,gu,th,ht,tr,iw,uk,hi,ur,hu,vi,is,cy,id,yi,error}

{=(COMMENT):The {langformat} variable in this part of the code isn't that important, it's just so that you can have the comma anywhere between the two languages and still have it work (english, spanish or english , spanish). After that, it's just seperating the languages from each other and the text.}
{=(langformat):{lower:{replace(%2C,,):{replace(%2C ,,):{replace( %2C,,):{replace( %2C ,,):{replace(%20, ):{urlencode:{replace( -,-):{args}}}}}}}}}}
{=(lang1):{replace( ,_):{langformat(1):,}}}
{=(lang2):{replace( ,_):{langformat(2):,}}}
{=(lang2):{lang2(1):-}}
{=(text):{urlencode:{if({in(- ):{args(+8)}}==true):{args(2+):- }|{args(2+):-}}}}

{=(comment):Another unimportant part; here, the languages are appropriately capitalized so they can be used later in the title of the embed block. E.g., even if you used "[p]translate eNgLiSH, sPAnISH", the variable {lang1title} would just be "English".}
{=(lang1title):{if({index({lang1}):{lower:{langs}}}!=-1):{replace(_, ):{list({index({lang1}):{lower:{langs}}}):{replace( ,,):{langs}}}}|{replace(_, ):{list({index({lang1}):{replace(%2C, ):{urlencode:{abbrevs}}}}):{join(,):{langs}}}}}}
{=(lang2title):{if({index({lang2}):{lower:{langs}}}!=-1):{replace(_, ):{list({index({lang2}):{lower:{langs}}}):{replace( ,,):{langs}}}}|{replace(_, ):{list({index({lang2}):{replace(%2C, ):{urlencode:{abbrevs}}}}):{join(,):{langs}}}}}}

{=(COMMENT):This is that part I mentioned earlier where the lists are used to convert the language to it's language code.}
{=(abbrev1):{if({index({lang1}):{lower:{langs}}}!=-1):{list({index({lang1}):{lower:{langs}}}):{abbrevs}}|{if({in({lang1}):{abbrevs}}==false):error|{lang1}}}}
{=(abbrev2):{if({index({lang2}):{lower:{langs}}}!=-1):{list({index({lang2}):{lower:{langs}}}):{abbrevs}}|{if({in({lang2}):{abbrevs}}==false):error|{lang2}}}}

{=(COMMENT):This part checks to see if there's an error in the user's input. If there is an error, it then decides which error message to use and it's according title.}
{=(error):{if({lower:{args(1)}}==langs):no|{any({lang1title}==error|{lang2title}==error):yes|{if({lang1title}=={lang2title}):yes|no}}}}
{=(errtitle):{all({lang1title}==error|{lang2title}==error|{in(,):{args}}!=false):Invalid languages!|{any({lang1title}==error|{lang2title}==error):Invalid language!|{if({lang1title}=={lang2title}):Your translation:|no error}}}}
{=(errmsg):{any({lang1title}==error|{lang2title}==error):**Usage:** `{prefix}translate <language1>, <language2> - <text>`
Use `{prefix}translate langs` for a list of each supported language and its language code.|{if({lang1title}=={lang2title}):What do you think?|no error}}}

{=(COMMENT):Here's the link!}
{=(link):https://translate.google.com/#view=home&op=translate&sl={abbrev1}&tl={abbrev2}&text={text}}

{=(COMMENT):Output, pretty simple.}
{=(output):{if({error}==no):{if({lower:{args(1)}}!=langs):[**Click here for your translation!**]({link} "Click here for your translation!")
Run `{prefix}translate langs` for a list of the supported languages and their language codes.|
**Detect Language** - `auto`
**Afrikaans** - `af`
**Albanian** - `sq`
**Arabic** - `ar`
**Azerbaijani** - `az`
**Basque** - `eu`
**Belarusian** - `be`
**Bengali** - `bn`
**Bulgarian** - `bg`
**Catalan** - `ca`
**Chinese Simplified** - `zh-CN`
**Chinese Traditional** - `zh-TW`
**Croatian** - `hr`
**Czech** - `cs`
**Danish** - `da`
**Dutch** - `nl`
**English** - `en`
**Esperanto** - `eo`
**Estonian** - `et`
**Filipino** - `tl`
**Finnish** - `fi`
**French** - `fr`
**Galician** - `gl`
**Georgian** - `ka`
**German** - `de`
**Greek** - `el`
**Gujarati** - `gu`
**Haitian Creole** - `ht`
**Hebrew** - `iw`
**Hindi** - `hi`
**Hungarian** - `hu`
**Icelandic** - `is`
**Indonesian** - `id`
**Irish** - `ga`
**Italian** - `it`
**Japanese** - `ja`
**Kannada** - `kn`
**Korean** - `ko`
**Latin** - `la`
**Latvian** - `lv`
**Lithuanian** - `lt`
**Macedonian** - `mk`
**Malay** - `ms`
**Maltese** - `mt`
**Norwegian** - `no`
**Persian** - `fa`
**Polish** - `pl`
**Portuguese** - `pt`
**Romanian** - `ro`
**Russian** - `ru`
**Serbian** - `sr`
**Slovak** - `sk`
**Slovenian** - `sl`
**Spanish** - `es`
**Swahili** - `sw`
**Swedish** - `sv`
**Tamil** - `ta`
**Telugu** - `te`
**Thai** - `th`
**Turkish** - `tr`
**Ukrainian** - `uk`
**Urdu** - `ur`
**Vietnamese** - `vi`
**Welsh** - `cy`
**Yiddish** - `yi`}|{errmsg}}}

{=(COMMENT):Finally, this part gets a random hex color using rand blocks and either uses that color if the {embedcolor} variable is "random", or just uses the color the {embedcolor} variable is equal to.}
{=(c):#:1~2~3~4~5~6~7~8~9~0~A~B~C~D~E~F}
{embed(color):{if({embedcolor}==random):#{{c}}{{c}}{{c}}{{c}}{{c}}{{c}}|{embedcolor}}}

{=(COMMENT):In case you couldn't tell, I'm not a good teacher. I hope these comments helped a bit or at least occupied you for two minutes of your life.}

Embed

1 line
{"color": 5198940, "title": "{if({error}==no):{if({lower:{args(1)}}==langs):Supported Languages and their Language Codes|{lang1title} to {lang2title} Translation}|{errtitle}}", "description": "{output}"}
Raw JSON
{
  "id": 574134,
  "created_at": "2021-02-01T09:16:55.000Z",
  "tag_name": "translate",
  "nsfw": false,
  "owner_id": "650362174501552134",
  "uses": 3,
  "description": null,
  "restricted": false,
  "shared": false,
  "deleted": false,
  "safe": "unrated",
  "hidden": false,
  "guild_id": "657692633283559436",
  "sharer": "650362174501552134",
  "content": "{=(COMMENT):You can set the embed color to be a hex color code (#7289DA, #123456) or you can put \"random\" if you want it to be a random color. If the hex color code is invalid, the embed color will just be grey.}\n{=(embedcolor):random}\n\n{=(COMMENT):Set the prefix you use for the bot in your server!}\n{=(prefix):!}\n\n{=(COMMENT):The rest is just code, you don't have to do anything.}\n\n{=(COMMENT):DO NOT TOUCH! The lists below are used later to convert each language to it's language code (necessary for the Google Translate link) and the order matters!}\n{=(langs):Detect_Language Afrikaans Irish Albanian Italian Arabic Japanese Azerbaijani Kannada Basque Korean Bengali Latin Belarusian Latvian Bulgarian Lithuanian Catalan Macedonian Chinese_Simplified Malay Chinese_Traditional Maltese Croatian Norwegian Czech Persian Danish Polish Dutch Portuguese English Romanian Esperanto Russian Estonian Serbian Filipino Slovak Finnish Slovenian French Spanish Galician Swahili Georgian Swedish German Tamil Greek Telugu Gujarati Thai Haitian_Creole Turkish Hebrew Ukrainian Hindi Urdu Hungarian Vietnamese Icelandic Welsh Indonesian Yiddish error}\n{=(abbrevs):auto,af,ga,sq,it,ar,ja,az,kn,eu,ko,bn,la,be,lv,bg,lt,ca,mk,zh-CN,ms,zh-TW,mt,hr,no,cs,fa,da,pl,nl,pt,en,ro,eo,ru,et,sr,tl,sk,fi,sl,fr,es,gl,sw,ka,sv,de,ta,el,te,gu,th,ht,tr,iw,uk,hi,ur,hu,vi,is,cy,id,yi,error}\n\n{=(COMMENT):The {langformat} variable in this part of the code isn't that important, it's just so that you can have the comma anywhere between the two languages and still have it work (english, spanish or english , spanish). After that, it's just seperating the languages from each other and the text.}\n{=(langformat):{lower:{replace(%2C,,):{replace(%2C ,,):{replace( %2C,,):{replace( %2C ,,):{replace(%20, ):{urlencode:{replace( -,-):{args}}}}}}}}}}\n{=(lang1):{replace( ,_):{langformat(1):,}}}\n{=(lang2):{replace( ,_):{langformat(2):,}}}\n{=(lang2):{lang2(1):-}}\n{=(text):{urlencode:{if({in(- ):{args(+8)}}==true):{args(2+):- }|{args(2+):-}}}}\n\n{=(comment):Another unimportant part; here, the languages are appropriately capitalized so they can be used later in the title of the embed block. E.g., even if you used \"[p]translate eNgLiSH, sPAnISH\", the variable {lang1title} would just be \"English\".}\n{=(lang1title):{if({index({lang1}):{lower:{langs}}}!=-1):{replace(_, ):{list({index({lang1}):{lower:{langs}}}):{replace( ,,):{langs}}}}|{replace(_, ):{list({index({lang1}):{replace(%2C, ):{urlencode:{abbrevs}}}}):{join(,):{langs}}}}}}\n{=(lang2title):{if({index({lang2}):{lower:{langs}}}!=-1):{replace(_, ):{list({index({lang2}):{lower:{langs}}}):{replace( ,,):{langs}}}}|{replace(_, ):{list({index({lang2}):{replace(%2C, ):{urlencode:{abbrevs}}}}):{join(,):{langs}}}}}}\n\n{=(COMMENT):This is that part I mentioned earlier where the lists are used to convert the language to it's language code.}\n{=(abbrev1):{if({index({lang1}):{lower:{langs}}}!=-1):{list({index({lang1}):{lower:{langs}}}):{abbrevs}}|{if({in({lang1}):{abbrevs}}==false):error|{lang1}}}}\n{=(abbrev2):{if({index({lang2}):{lower:{langs}}}!=-1):{list({index({lang2}):{lower:{langs}}}):{abbrevs}}|{if({in({lang2}):{abbrevs}}==false):error|{lang2}}}}\n\n{=(COMMENT):This part checks to see if there's an error in the user's input. If there is an error, it then decides which error message to use and it's according title.}\n{=(error):{if({lower:{args(1)}}==langs):no|{any({lang1title}==error|{lang2title}==error):yes|{if({lang1title}=={lang2title}):yes|no}}}}\n{=(errtitle):{all({lang1title}==error|{lang2title}==error|{in(,):{args}}!=false):Invalid languages!|{any({lang1title}==error|{lang2title}==error):Invalid language!|{if({lang1title}=={lang2title}):Your translation:|no error}}}}\n{=(errmsg):{any({lang1title}==error|{lang2title}==error):**Usage:** `{prefix}translate <language1>, <language2> - <text>`\nUse `{prefix}translate langs` for a list of each supported language and its language code.|{if({lang1title}=={lang2title}):What do you think?|no error}}}\n\n{=(COMMENT):Here's the link!}\n{=(link):https://translate.google.com/#view=home&op=translate&sl={abbrev1}&tl={abbrev2}&text={text}}\n\n{=(COMMENT):Output, pretty simple.}\n{=(output):{if({error}==no):{if({lower:{args(1)}}!=langs):[**Click here for your translation!**]({link} \"Click here for your translation!\")\nRun `{prefix}translate langs` for a list of the supported languages and their language codes.|\n**Detect Language** - `auto`\n**Afrikaans** - `af`\n**Albanian** - `sq`\n**Arabic** - `ar`\n**Azerbaijani** - `az`\n**Basque** - `eu`\n**Belarusian** - `be`\n**Bengali** - `bn`\n**Bulgarian** - `bg`\n**Catalan** - `ca`\n**Chinese Simplified** - `zh-CN`\n**Chinese Traditional** - `zh-TW`\n**Croatian** - `hr`\n**Czech** - `cs`\n**Danish** - `da`\n**Dutch** - `nl`\n**English** - `en`\n**Esperanto** - `eo`\n**Estonian** - `et`\n**Filipino** - `tl`\n**Finnish** - `fi`\n**French** - `fr`\n**Galician** - `gl`\n**Georgian** - `ka`\n**German** - `de`\n**Greek** - `el`\n**Gujarati** - `gu`\n**Haitian Creole** - `ht`\n**Hebrew** - `iw`\n**Hindi** - `hi`\n**Hungarian** - `hu`\n**Icelandic** - `is`\n**Indonesian** - `id`\n**Irish** - `ga`\n**Italian** - `it`\n**Japanese** - `ja`\n**Kannada** - `kn`\n**Korean** - `ko`\n**Latin** - `la`\n**Latvian** - `lv`\n**Lithuanian** - `lt`\n**Macedonian** - `mk`\n**Malay** - `ms`\n**Maltese** - `mt`\n**Norwegian** - `no`\n**Persian** - `fa`\n**Polish** - `pl`\n**Portuguese** - `pt`\n**Romanian** - `ro`\n**Russian** - `ru`\n**Serbian** - `sr`\n**Slovak** - `sk`\n**Slovenian** - `sl`\n**Spanish** - `es`\n**Swahili** - `sw`\n**Swedish** - `sv`\n**Tamil** - `ta`\n**Telugu** - `te`\n**Thai** - `th`\n**Turkish** - `tr`\n**Ukrainian** - `uk`\n**Urdu** - `ur`\n**Vietnamese** - `vi`\n**Welsh** - `cy`\n**Yiddish** - `yi`}|{errmsg}}}\n\n{=(COMMENT):Finally, this part gets a random hex color using rand blocks and either uses that color if the {embedcolor} variable is \"random\", or just uses the color the {embedcolor} variable is equal to.}\n{=(c):#:1~2~3~4~5~6~7~8~9~0~A~B~C~D~E~F}\n{embed(color):{if({embedcolor}==random):#{{c}}{{c}}{{c}}{{c}}{{c}}{{c}}|{embedcolor}}}\n\n{=(COMMENT):In case you couldn't tell, I'm not a good teacher. I hope these comments helped a bit or at least occupied you for two minutes of your life.}",
  "embed": "{\"color\": 5198940, \"title\": \"{if({error}==no):{if({lower:{args(1)}}==langs):Supported Languages and their Language Codes|{lang1title} to {lang2title} Translation}|{errtitle}}\", \"description\": \"{output}\"}",
  "last_fetched": "2026-10-21T00:03:53.318Z"
}