import requests
import os
langs_data={
"APP": {
"default": "APP",
"en": "APP",
"de": "APP",
"fr": "APP",
"az": "APP"
},
"文本": {
"default": "文本",
"en": "Text",
"de": "Text",
"fr": "Texte",
"az": "Mətn"
},
"在这里输入文本": {
"default": "在这里输入文本",
"en": "Enter text here",
"de": "Hier Text eingeben",
"fr": "Entrez du texte ici",
"az": "Mətni buraya daxil edin"
},
"选择性别": {
"default": "选择性别",
"en": "Select gender",
"de": "Geschlecht wählen",
"fr": "Sélectionner le sexe",
"az": "Cinsiyyəti seçin"
},
"选择发音人": {
"default": "选择发音人",
"en": "Select voice",
"de": "Sprecher wählen",
"fr": "Sélectionner la voix",
"az": "Səsi seçin"
},
"合成的语音": {
"default": "合成的语音",
"en": "Synthesized speech",
"de": "Synthetische Sprache",
"fr": "Parole synthétisée",
"az": "Sintez dil"
},
"选择语言": {
"default": "选择语言",
"en": "Select Language",
"de": "Sprache auswählen",
"fr": "Sélectionner la langue",
"az": "Dil seçin"
},
"遇到未知错误,联系作者处理": {
"default": "遇到未知错误,联系作者处理",
"en": "Encountered an unknown error, contact the author for assistance",
"de": "Es ist ein unbekannter Fehler aufgetreten, wenden Sie sich an den Autor",
"fr": "Erreur inconnue rencontrée, contactez l'auteur pour obtenir de l'aide",
"az": "Bilinmeyen bir hata oluştu, yardım için yazar ile iletişime geçin"
},
"Gradio 版 OpenAI/Edge 文字转语音": {
"default": "Gradio 版 OpenAI/Edge 文字转语音",
"en": "Gradio version OpenAI/Edge Text-to-Speech",
"de": "Gradio Version OpenAI/Edge Text-to-Speech",
"fr": "Gradio version OpenAI/Edge Text-to-Speech",
"az": "Gradio versionu OpenAI/Edge Metin-səsə çevirmə"
},
"tailer_markdown": {
"default": "\n
\n\n**[作者](https://github.com/linexjlin)的其他项目**\n\n| | |\n| ------------------------------- | --------------------------------------- |\n| 👨🏻💻 **InputGPT 任意输入区调用GPT** | [InputGPT](https://github.com/linexjlin/inputGPT) |\n| 👨🏻💻 **OpenAI_TTS 需要自己的key** | [OpenAI_TTS](https://modelscope.cn/studios/VBNn0x/OpenAI_TTS_TEST/summary) |\n| 👨🏻💻 **伴奏人声提取** | [UVR](https://modelscope.cn/studios/VBNn0x/UVR/summary) |\n\nAIGC 交流 💬\n\n

![]()
\n\n
\n 遇到问题联系\n
\n cmVkX2xhbmQ= (base64)\n
\n\n\n\n
\n",
"en": "\n\n**[My](https://github.com/linexjlin) other projects.**\n\n|||\n| - | -|\n| 👨🏻💻 **InputGPT Call GPT in any input area** | [InputGPT](https://github.com/linexjlin/inputGPT) |\n\nContact me: [𝕏](https://twitter.com/linexjlin) [github](https://github.com/linexjlin)\n\n\n\n
\n",
"de": "\n\n**[My](https://github.com/linexjlin) other projects.**\n\n|||\n| - | -|\n| 👨🏻💻 **InputGPT Call GPT in any input area** | [InputGPT](https://github.com/linexjlin/inputGPT) |\n\nContact me: [𝕏](https://twitter.com/linexjlin) [github](https://github.com/linexjlin)\n\n\n\n
\n",
"fr": "\n\n**[My](https://github.com/linexjlin) other projects.**\n\n|||\n| - | -|\n| 👨🏻💻 **InputGPT Call GPT in any input area** | [InputGPT](https://github.com/linexjlin/inputGPT) |\n\nContact me: [𝕏](https://twitter.com/linexjlin) [github](https://github.com/linexjlin)\n\n\n\n
\n",
"az": "\n\n**[My](https://github.com/linexjlin) other projects.**\n\n|||\n| - | -|\n| 👨🏻💻 **InputGPT Call GPT in any input area** | [InputGPT](https://github.com/linexjlin/inputGPT) |\n\nContact me: [𝕏](https://twitter.com/linexjlin) [github](https://github.com/linexjlin)\n\n\n\n
\n"
}
}
def UText(k):
l = os.getenv("ULANG") if os.getenv("ULANG") else "default"
if k in langs_data:
if l in langs_data[k]:
return langs_data[k][l] if langs_data[k][l] else k
else:
print(f"not supported lang: {l}")
request_online(k,l)
return k
else:
request_online(k,l)
return k
def request_online(k,l):
url = f"https://i18n.linkown.com/ce405723-a840-468d-a57f-0bb95cbfbcfb/key" # Replace with the actual URL of your API endpoint
params = {'k': k,'l':l}
response = requests.get(url, params=params)
if response.status_code == 200:
result = response.json()["result"]
return result
else:
print(f"Failed to get data. Status code: {response.status_code}")