File size: 5,928 Bytes
704d09b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
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<div align=\"center\">\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<img  src=\"https://cn-hz-ali.oss-cn-hangzhou.aliyuncs.com/js/aigc-share.svg\"><img>\n\n<p>\n    遇到问题联系\n    <img width=15 src=\"https://cn-hz-ali.oss-cn-hangzhou.aliyuncs.com/js/wechat.svg\" style=\"display: inline-block; vertical-align: middle;\">  \n    cmVkX2xhbmQ= (base64)\n</p>\n\n![Visitors](https://api.visitorbadge.io/api/visitors?path=M5eX5Jypd1ueCz23kiCH&labelColor=%232ccce4&countColor=%23263759)\n\n</div>\n",
        "en": "<div align=\"center\">\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![Visitors](https://api.visitorbadge.io/api/visitors?path=M5eX5Jypd1ueCz23kiCH&labelColor=%232ccce4&countColor=%23263759)\n\n</div>\n",
        "de": "<div align=\"center\">\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![Visitors](https://api.visitorbadge.io/api/visitors?path=M5eX5Jypd1ueCz23kiCH&labelColor=%232ccce4&countColor=%23263759)\n\n</div>\n",
        "fr": "<div align=\"center\">\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![Visitors](https://api.visitorbadge.io/api/visitors?path=M5eX5Jypd1ueCz23kiCH&labelColor=%232ccce4&countColor=%23263759)\n\n</div>\n",
        "az": "<div align=\"center\">\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![Visitors](https://api.visitorbadge.io/api/visitors?path=M5eX5Jypd1ueCz23kiCH&labelColor=%232ccce4&countColor=%23263759)\n\n</div>\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}")