mirror of
https://codeberg.org/aryak/mozhi
synced 2024-11-16 07:32:57 +05:30
go mod tidy + gofmt
This commit is contained in:
parent
e559ec9214
commit
9c2eaa6b99
@ -2,8 +2,8 @@ package cmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"codeberg.org/aryak/simplytranslate/utils"
|
"codeberg.org/aryak/simplytranslate/utils"
|
||||||
"github.com/spf13/cobra"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
var file string
|
var file string
|
||||||
|
@ -2,8 +2,8 @@ package cmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"codeberg.org/aryak/simplytranslate/utils"
|
"codeberg.org/aryak/simplytranslate/utils"
|
||||||
"github.com/spf13/cobra"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
var engine string
|
var engine string
|
||||||
@ -51,21 +51,9 @@ var translateCmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
} else if engine == "yandex" {
|
} else if engine == "yandex" {
|
||||||
if langlist == "sl" {
|
if langlist == "sl" {
|
||||||
langList := utils.LangListYandex(langlist)
|
fmt.Println(utils.LangListYandex(langlist))
|
||||||
for _, num := range langList {
|
|
||||||
fmt.Println("List{")
|
|
||||||
fmt.Println(`Id: "`+num.Id+`",`)
|
|
||||||
fmt.Println(`Name: "`+num.Name+`",`)
|
|
||||||
fmt.Println("},")
|
|
||||||
}
|
|
||||||
} else if langlist == "tl" {
|
} else if langlist == "tl" {
|
||||||
langList := utils.LangListYandex(langlist)
|
fmt.Println(utils.LangListYandex(langlist))
|
||||||
for _, num := range langList {
|
|
||||||
fmt.Println("List{")
|
|
||||||
fmt.Println(`Id: "`+num.Id+`",`)
|
|
||||||
fmt.Println(`Name: "`+num.Name+`",`)
|
|
||||||
fmt.Println("},")
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
fmt.Println(utils.TranslateYandex(dest, source, query))
|
fmt.Println(utils.TranslateYandex(dest, source, query))
|
||||||
}
|
}
|
||||||
|
4
go.mod
4
go.mod
@ -3,9 +3,11 @@ module codeberg.org/aryak/simplytranslate
|
|||||||
go 1.20
|
go 1.20
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
github.com/carlmjohnson/requests v0.23.4
|
||||||
github.com/gocolly/colly v1.2.0
|
github.com/gocolly/colly v1.2.0
|
||||||
github.com/gofiber/fiber/v2 v2.47.0
|
github.com/gofiber/fiber/v2 v2.47.0
|
||||||
github.com/gofiber/template v1.8.0
|
github.com/gofiber/template v1.8.0
|
||||||
|
github.com/google/go-querystring v1.1.0
|
||||||
github.com/joho/godotenv v1.5.1
|
github.com/joho/godotenv v1.5.1
|
||||||
github.com/otiai10/gosseract/v2 v2.4.0
|
github.com/otiai10/gosseract/v2 v2.4.0
|
||||||
github.com/spf13/cobra v1.7.0
|
github.com/spf13/cobra v1.7.0
|
||||||
@ -19,12 +21,10 @@ require (
|
|||||||
github.com/antchfx/htmlquery v1.3.0 // indirect
|
github.com/antchfx/htmlquery v1.3.0 // indirect
|
||||||
github.com/antchfx/xmlquery v1.3.17 // indirect
|
github.com/antchfx/xmlquery v1.3.17 // indirect
|
||||||
github.com/antchfx/xpath v1.2.4 // indirect
|
github.com/antchfx/xpath v1.2.4 // indirect
|
||||||
github.com/carlmjohnson/requests v0.23.4 // indirect
|
|
||||||
github.com/gobwas/glob v0.2.3 // indirect
|
github.com/gobwas/glob v0.2.3 // indirect
|
||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||||
github.com/golang/protobuf v1.5.3 // indirect
|
github.com/golang/protobuf v1.5.3 // indirect
|
||||||
github.com/google/go-cmp v0.5.9 // indirect
|
github.com/google/go-cmp v0.5.9 // indirect
|
||||||
github.com/google/go-querystring v1.1.0 // indirect
|
|
||||||
github.com/google/uuid v1.3.0 // indirect
|
github.com/google/uuid v1.3.0 // indirect
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||||
github.com/kennygrant/sanitize v1.2.4 // indirect
|
github.com/kennygrant/sanitize v1.2.4 // indirect
|
||||||
|
16
go.sum
16
go.sum
@ -62,14 +62,11 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF
|
|||||||
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||||
github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs=
|
github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs=
|
||||||
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
|
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
|
||||||
github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c=
|
|
||||||
github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA=
|
github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA=
|
||||||
github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss=
|
github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss=
|
||||||
github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU=
|
github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU=
|
||||||
github.com/antchfx/htmlquery v1.3.0 h1:5I5yNFOVI+egyia5F2s/5Do2nFWxJz41Tr3DyfKD25E=
|
github.com/antchfx/htmlquery v1.3.0 h1:5I5yNFOVI+egyia5F2s/5Do2nFWxJz41Tr3DyfKD25E=
|
||||||
github.com/antchfx/htmlquery v1.3.0/go.mod h1:zKPDVTMhfOmcwxheXUsx4rKJy8KEY/PU6eXr/2SebQ8=
|
github.com/antchfx/htmlquery v1.3.0/go.mod h1:zKPDVTMhfOmcwxheXUsx4rKJy8KEY/PU6eXr/2SebQ8=
|
||||||
github.com/antchfx/xmlquery v1.3.15 h1:aJConNMi1sMha5G8YJoAIF5P+H+qG1L73bSItWHo8Tw=
|
|
||||||
github.com/antchfx/xmlquery v1.3.15/go.mod h1:zMDv5tIGjOxY/JCNNinnle7V/EwthZ5IT8eeCGJKRWA=
|
|
||||||
github.com/antchfx/xmlquery v1.3.17 h1:d0qWjPp/D+vtRw7ivCwT5ApH/3CkQU8JOeo3245PpTk=
|
github.com/antchfx/xmlquery v1.3.17 h1:d0qWjPp/D+vtRw7ivCwT5ApH/3CkQU8JOeo3245PpTk=
|
||||||
github.com/antchfx/xmlquery v1.3.17/go.mod h1:Afkq4JIeXut75taLSuI31ISJ/zeq+3jG7TunF7noreA=
|
github.com/antchfx/xmlquery v1.3.17/go.mod h1:Afkq4JIeXut75taLSuI31ISJ/zeq+3jG7TunF7noreA=
|
||||||
github.com/antchfx/xpath v1.2.3/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
|
github.com/antchfx/xpath v1.2.3/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
|
||||||
@ -149,7 +146,6 @@ github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJA
|
|||||||
github.com/gocolly/colly v1.2.0 h1:qRz9YAn8FIH0qzgNUw+HT9UN7wm1oF9OBAilwEWpyrI=
|
github.com/gocolly/colly v1.2.0 h1:qRz9YAn8FIH0qzgNUw+HT9UN7wm1oF9OBAilwEWpyrI=
|
||||||
github.com/gocolly/colly v1.2.0/go.mod h1:Hof5T3ZswNVsOHYmba1u03W65HDWgpV5HifSuueE0EA=
|
github.com/gocolly/colly v1.2.0/go.mod h1:Hof5T3ZswNVsOHYmba1u03W65HDWgpV5HifSuueE0EA=
|
||||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||||
github.com/gofiber/fiber/v2 v2.43.0 h1:yit3E4kHf178B60p5CQBa/3v+WVuziWMa/G2ZNyLJB0=
|
|
||||||
github.com/gofiber/fiber/v2 v2.43.0/go.mod h1:mpS1ZNE5jU+u+BA4FbM+KKnUzJ4wzTK+FT2tG3tU+6I=
|
github.com/gofiber/fiber/v2 v2.43.0/go.mod h1:mpS1ZNE5jU+u+BA4FbM+KKnUzJ4wzTK+FT2tG3tU+6I=
|
||||||
github.com/gofiber/fiber/v2 v2.47.0 h1:EN5lHVCc+Pyqh5OEsk8fzRiifgwpbrP0rulQ4iNf3fs=
|
github.com/gofiber/fiber/v2 v2.47.0 h1:EN5lHVCc+Pyqh5OEsk8fzRiifgwpbrP0rulQ4iNf3fs=
|
||||||
github.com/gofiber/fiber/v2 v2.47.0/go.mod h1:mbFMVN1lQuzziTkkakgtKKdjfsXSw9BKR5lmcNksUoU=
|
github.com/gofiber/fiber/v2 v2.47.0/go.mod h1:mbFMVN1lQuzziTkkakgtKKdjfsXSw9BKR5lmcNksUoU=
|
||||||
@ -272,7 +268,6 @@ github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47
|
|||||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||||
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||||
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
|
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
|
||||||
@ -288,7 +283,6 @@ github.com/kennygrant/sanitize v1.2.4 h1:gN25/otpP5vAsO2djbMhF/LQX6R7+O1TB4yv8Nz
|
|||||||
github.com/kennygrant/sanitize v1.2.4/go.mod h1:LGsjYYtgxbetdg5owWB2mpgUL6e2nfw2eObZ0u0qvak=
|
github.com/kennygrant/sanitize v1.2.4/go.mod h1:LGsjYYtgxbetdg5owWB2mpgUL6e2nfw2eObZ0u0qvak=
|
||||||
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
||||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||||
github.com/klauspost/compress v1.16.3 h1:XuJt9zzcnaz6a16/OU53ZjWp/v7/42WcR5t2a0PcNQY=
|
|
||||||
github.com/klauspost/compress v1.16.3/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
github.com/klauspost/compress v1.16.3/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
||||||
github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I=
|
github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I=
|
||||||
github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
||||||
@ -317,8 +311,6 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky
|
|||||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98=
|
|
||||||
github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
|
||||||
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
|
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
|
||||||
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
|
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
|
||||||
@ -396,8 +388,6 @@ github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY52
|
|||||||
github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I=
|
github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I=
|
||||||
github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||||
github.com/spf13/cobra v1.3.0/go.mod h1:BrRVncBjOJa/eUcVVm9CE+oC6as8k+VYr4NY7WCi9V4=
|
github.com/spf13/cobra v1.3.0/go.mod h1:BrRVncBjOJa/eUcVVm9CE+oC6as8k+VYr4NY7WCi9V4=
|
||||||
github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA=
|
|
||||||
github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=
|
|
||||||
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
|
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
|
||||||
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
|
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
|
||||||
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
|
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
|
||||||
@ -434,7 +424,6 @@ github.com/tinylib/msgp v1.1.8/go.mod h1:qkpG+2ldGg4xRFmx+jfTvZPxfGFhi64BcnL9vkC
|
|||||||
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
|
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
|
||||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||||
github.com/valyala/fasthttp v1.45.0 h1:zPkkzpIn8tdHZUrVa6PzYd0i5verqiPSkgTd3bSUcpA=
|
|
||||||
github.com/valyala/fasthttp v1.45.0/go.mod h1:k2zXd82h/7UZc3VOdJ2WaUqt1uZ/XpXAfE9i+HBC3lA=
|
github.com/valyala/fasthttp v1.45.0/go.mod h1:k2zXd82h/7UZc3VOdJ2WaUqt1uZ/XpXAfE9i+HBC3lA=
|
||||||
github.com/valyala/fasthttp v1.48.0 h1:oJWvHb9BIZToTQS3MuQ2R3bJZiNSa2KiNdeI8A+79Tc=
|
github.com/valyala/fasthttp v1.48.0 h1:oJWvHb9BIZToTQS3MuQ2R3bJZiNSa2KiNdeI8A+79Tc=
|
||||||
github.com/valyala/fasthttp v1.48.0/go.mod h1:k2zXd82h/7UZc3VOdJ2WaUqt1uZ/XpXAfE9i+HBC3lA=
|
github.com/valyala/fasthttp v1.48.0/go.mod h1:k2zXd82h/7UZc3VOdJ2WaUqt1uZ/XpXAfE9i+HBC3lA=
|
||||||
@ -563,7 +552,6 @@ golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
|
|||||||
golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
|
golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
|
||||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||||
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||||
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
|
|
||||||
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
||||||
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
|
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
|
||||||
golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50=
|
golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50=
|
||||||
@ -670,7 +658,6 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc
|
|||||||
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
|
|
||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
|
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
|
||||||
@ -694,7 +681,6 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
|||||||
golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=
|
|
||||||
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||||
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
|
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
|
||||||
@ -909,8 +895,6 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba
|
|||||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
|
|
||||||
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
|
||||||
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
|
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
|
||||||
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||||
|
@ -21,7 +21,6 @@ func HandleSourceLanguages(c *fiber.Ctx) error {
|
|||||||
data = utils.LangListDeepl("sl")
|
data = utils.LangListDeepl("sl")
|
||||||
} else if engine == "watson" {
|
} else if engine == "watson" {
|
||||||
data = utils.LangListWatson("sl")
|
data = utils.LangListWatson("sl")
|
||||||
}
|
|
||||||
} else if engine == "yandex" {
|
} else if engine == "yandex" {
|
||||||
data = utils.LangListYandex("sl")
|
data = utils.LangListYandex("sl")
|
||||||
}
|
}
|
||||||
@ -43,7 +42,6 @@ func HandleTargetLanguages(c *fiber.Ctx) error {
|
|||||||
data = utils.LangListDeepl("tl")
|
data = utils.LangListDeepl("tl")
|
||||||
} else if engine == "watson" {
|
} else if engine == "watson" {
|
||||||
data = utils.LangListWatson("tl")
|
data = utils.LangListWatson("tl")
|
||||||
}
|
|
||||||
} else if engine == "yandex" {
|
} else if engine == "yandex" {
|
||||||
data = utils.LangListYandex("tl")
|
data = utils.LangListYandex("tl")
|
||||||
}
|
}
|
||||||
@ -52,7 +50,7 @@ func HandleTargetLanguages(c *fiber.Ctx) error {
|
|||||||
func HandleTTS(c *fiber.Ctx) error {
|
func HandleTTS(c *fiber.Ctx) error {
|
||||||
engine := c.Query("engine")
|
engine := c.Query("engine")
|
||||||
lang := c.Query("lang")
|
lang := c.Query("lang")
|
||||||
text := c.Query("text")
|
text := c.Query("text")
|
||||||
// Why does go not have an andor statement :(
|
// Why does go not have an andor statement :(
|
||||||
if engine == "" {
|
if engine == "" {
|
||||||
return c.SendStatus(fiber.StatusBadRequest)
|
return c.SendStatus(fiber.StatusBadRequest)
|
||||||
@ -67,6 +65,6 @@ func HandleTTS(c *fiber.Ctx) error {
|
|||||||
} else if engine == "reverso" {
|
} else if engine == "reverso" {
|
||||||
data = utils.TTSReverso(lang, text)
|
data = utils.TTSReverso(lang, text)
|
||||||
}
|
}
|
||||||
c.Set("Content-Type", "audio/mpeg")
|
c.Set("Content-Type", "audio/mpeg")
|
||||||
return c.Send([]byte(data))
|
return c.Send([]byte(data))
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,27 @@
|
|||||||
package pages
|
package pages
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
"runtime"
|
|
||||||
|
|
||||||
"codeberg.org/aryak/simplytranslate/utils"
|
"codeberg.org/aryak/simplytranslate/utils"
|
||||||
|
"fmt"
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
|
"runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
func HandleIndex(c *fiber.Ctx) error {
|
func HandleIndex(c *fiber.Ctx) error {
|
||||||
|
// Check if all required queries are present
|
||||||
|
m := c.Queries()
|
||||||
|
sl, _ := m["sl"]
|
||||||
|
tl, _ := m["tl"]
|
||||||
|
engine, _ := m["engine"]
|
||||||
|
text, _ := m["text"]
|
||||||
|
if sl != "" && tl != "" && engine != "" && text != "" {
|
||||||
|
fmt.Println("Work")
|
||||||
|
}
|
||||||
|
|
||||||
return c.Render("index", fiber.Map{
|
return c.Render("index", fiber.Map{
|
||||||
"host": c.Hostname(),
|
"host": c.Hostname(),
|
||||||
"branch": utils.Branch,
|
|
||||||
"version": utils.Version(),
|
"version": utils.Version(),
|
||||||
"fiberversion": fiber.Version,
|
"fiberversion": fiber.Version,
|
||||||
"goversion": runtime.Version(),
|
"goversion": runtime.Version(),
|
||||||
"setupstatus": os.Getenv("SIMPLYTRANSLATE_SETUP_COMPLETE"),
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -47,8 +47,8 @@ func Serve(port string) {
|
|||||||
}
|
}
|
||||||
link := strings.TrimPrefix(err.Error(), "Cannot GET ")
|
link := strings.TrimPrefix(err.Error(), "Cannot GET ")
|
||||||
err = ctx.Status(code).Render("error", fiber.Map{
|
err = ctx.Status(code).Render("error", fiber.Map{
|
||||||
"error": err,
|
"error": err,
|
||||||
"link": link,
|
"link": link,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
|
||||||
|
@ -17,14 +17,14 @@ func TranslateGoogle(to string, from string, text string) string {
|
|||||||
answer = e.Text
|
answer = e.Text
|
||||||
})
|
})
|
||||||
type Options struct {
|
type Options struct {
|
||||||
To string `url:"tl"`
|
To string `url:"tl"`
|
||||||
UI string `url:"hl"`
|
UI string `url:"hl"`
|
||||||
From string `url:"sl"`
|
From string `url:"sl"`
|
||||||
Text string `url:"q"`
|
Text string `url:"q"`
|
||||||
}
|
}
|
||||||
opt := Options{ to, to, from, text }
|
opt := Options{to, to, from, text}
|
||||||
v, _ := query.Values(opt)
|
v, _ := query.Values(opt)
|
||||||
url := "https://translate.google.com/m?"+v.Encode()
|
url := "https://translate.google.com/m?" + v.Encode()
|
||||||
sc.Visit(url)
|
sc.Visit(url)
|
||||||
return answer
|
return answer
|
||||||
}
|
}
|
||||||
@ -36,7 +36,7 @@ func TranslateReverso(to string, from string, query string) string {
|
|||||||
return answer
|
return answer
|
||||||
}
|
}
|
||||||
func TranslateLibreTranslate(to string, from string, query string) string {
|
func TranslateLibreTranslate(to string, from string, query string) string {
|
||||||
json := []byte(`{"q":"`+query+`","source":"`+from+`","target":"`+to+`"}`)
|
json := []byte(`{"q":"` + query + `","source":"` + from + `","target":"` + to + `"}`)
|
||||||
// TODO: Make it configurable
|
// TODO: Make it configurable
|
||||||
libreTranslateOut := PostRequest("https://translate.argosopentech.com/translate", json)
|
libreTranslateOut := PostRequest("https://translate.argosopentech.com/translate", json)
|
||||||
gjsonArr := libreTranslateOut.Get("translatedText").Array()
|
gjsonArr := libreTranslateOut.Get("translatedText").Array()
|
||||||
@ -44,24 +44,24 @@ func TranslateLibreTranslate(to string, from string, query string) string {
|
|||||||
return answer
|
return answer
|
||||||
}
|
}
|
||||||
func TranslateWatson(to string, from string, query string) string {
|
func TranslateWatson(to string, from string, query string) string {
|
||||||
json := []byte(`{"text":"`+query+`","source":"`+from+`","target":"`+to+`"}`)
|
json := []byte(`{"text":"` + query + `","source":"` + from + `","target":"` + to + `"}`)
|
||||||
watsonOut:= PostRequest("https://www.ibm.com/demos/live/watson-language-translator/api/translate/text", json)
|
watsonOut := PostRequest("https://www.ibm.com/demos/live/watson-language-translator/api/translate/text", json)
|
||||||
gjsonArr := watsonOut.Get("payload.translations.0.translation").Array()
|
gjsonArr := watsonOut.Get("payload.translations.0.translation").Array()
|
||||||
answer := gjsonArr[0].String()
|
answer := gjsonArr[0].String()
|
||||||
return answer
|
return answer
|
||||||
}
|
}
|
||||||
func TranslateYandex(to string, from string, text string) string {
|
func TranslateYandex(to string, from string, text string) string {
|
||||||
type Options struct {
|
type Options struct {
|
||||||
Translate string `url:"lang"`
|
Translate string `url:"lang"`
|
||||||
Text string `url:"text"`
|
Text string `url:"text"`
|
||||||
Srv string `url:"srv"`
|
Srv string `url:"srv"`
|
||||||
Id string `url:"id"`
|
Id string `url:"id"`
|
||||||
Reason string `url:"reason"`
|
Reason string `url:"reason"`
|
||||||
}
|
}
|
||||||
opt := Options{ from+"-"+to, text, "tr-mobile", "c2317111.64bac36a.ab16ef22.74722d6d6f62696c65-0-0", "submit"}
|
opt := Options{from + "-" + to, text, "tr-mobile", "c2317111.64bac36a.ab16ef22.74722d6d6f62696c65-0-0", "submit"}
|
||||||
v, _ := query.Values(opt)
|
v, _ := query.Values(opt)
|
||||||
|
|
||||||
yandexOut := GetRequest("https://translate.yandex.net/api/v1/tr.json/translate?"+v.Encode())
|
yandexOut := GetRequest("https://translate.yandex.net/api/v1/tr.json/translate?" + v.Encode())
|
||||||
gjsonArr := yandexOut.Get("text.0").Array()
|
gjsonArr := yandexOut.Get("text.0").Array()
|
||||||
answer := gjsonArr[0].String()
|
answer := gjsonArr[0].String()
|
||||||
return answer
|
return answer
|
||||||
|
@ -130,4 +130,3 @@ func LangListDeepl(listType string) []List {
|
|||||||
}
|
}
|
||||||
return ListData
|
return ListData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ type List struct {
|
|||||||
Id string
|
Id string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func LangListReverso(listType string) []List {
|
func LangListReverso(listType string) []List {
|
||||||
// IDs got from original simplytranslate-web and trial and error. Usually first three letters of language.
|
// IDs got from original simplytranslate-web and trial and error. Usually first three letters of language.
|
||||||
var ListData = []List{
|
var ListData = []List{
|
||||||
|
@ -2,414 +2,414 @@ package utils
|
|||||||
|
|
||||||
func LangListYandex(listType string) []List {
|
func LangListYandex(listType string) []List {
|
||||||
var ListData = []List{
|
var ListData = []List{
|
||||||
List{
|
List{
|
||||||
Id: "af",
|
Id: "af",
|
||||||
Name: "Afrikaans",
|
Name: "Afrikaans",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "sq",
|
Id: "sq",
|
||||||
Name: "Albanian",
|
Name: "Albanian",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "am",
|
Id: "am",
|
||||||
Name: "Amharic",
|
Name: "Amharic",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "ar",
|
Id: "ar",
|
||||||
Name: "Arabic",
|
Name: "Arabic",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "hy",
|
Id: "hy",
|
||||||
Name: "Armenian",
|
Name: "Armenian",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "az",
|
Id: "az",
|
||||||
Name: "Azerbaijani",
|
Name: "Azerbaijani",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "ba",
|
Id: "ba",
|
||||||
Name: "Bashkir",
|
Name: "Bashkir",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "eu",
|
Id: "eu",
|
||||||
Name: "Basque",
|
Name: "Basque",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "be",
|
Id: "be",
|
||||||
Name: "Belarusian",
|
Name: "Belarusian",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "bn",
|
Id: "bn",
|
||||||
Name: "Bengali",
|
Name: "Bengali",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "bs",
|
Id: "bs",
|
||||||
Name: "Bosnian",
|
Name: "Bosnian",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "bg",
|
Id: "bg",
|
||||||
Name: "Bulgarian",
|
Name: "Bulgarian",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "my",
|
Id: "my",
|
||||||
Name: "Burmese",
|
Name: "Burmese",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "ca",
|
Id: "ca",
|
||||||
Name: "Catalan",
|
Name: "Catalan",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "ceb",
|
Id: "ceb",
|
||||||
Name: "Cebuano",
|
Name: "Cebuano",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "zh",
|
Id: "zh",
|
||||||
Name: "Chinese",
|
Name: "Chinese",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "cv",
|
Id: "cv",
|
||||||
Name: "Chuvash",
|
Name: "Chuvash",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "hr",
|
Id: "hr",
|
||||||
Name: "Croatian",
|
Name: "Croatian",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "cs",
|
Id: "cs",
|
||||||
Name: "Czech",
|
Name: "Czech",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "da",
|
Id: "da",
|
||||||
Name: "Danish",
|
Name: "Danish",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "nl",
|
Id: "nl",
|
||||||
Name: "Dutch",
|
Name: "Dutch",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "sjn",
|
Id: "sjn",
|
||||||
Name: "Elvish (Sindarin)",
|
Name: "Elvish (Sindarin)",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "emj",
|
Id: "emj",
|
||||||
Name: "Emoji",
|
Name: "Emoji",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "en",
|
Id: "en",
|
||||||
Name: "English",
|
Name: "English",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "eo",
|
Id: "eo",
|
||||||
Name: "Esperanto",
|
Name: "Esperanto",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "et",
|
Id: "et",
|
||||||
Name: "Estonian",
|
Name: "Estonian",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "fi",
|
Id: "fi",
|
||||||
Name: "Finnish",
|
Name: "Finnish",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "fr",
|
Id: "fr",
|
||||||
Name: "French",
|
Name: "French",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "gl",
|
Id: "gl",
|
||||||
Name: "Galician",
|
Name: "Galician",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "ka",
|
Id: "ka",
|
||||||
Name: "Georgian",
|
Name: "Georgian",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "de",
|
Id: "de",
|
||||||
Name: "German",
|
Name: "German",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "el",
|
Id: "el",
|
||||||
Name: "Greek",
|
Name: "Greek",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "gu",
|
Id: "gu",
|
||||||
Name: "Gujarati",
|
Name: "Gujarati",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "ht",
|
Id: "ht",
|
||||||
Name: "Haitian",
|
Name: "Haitian",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "he",
|
Id: "he",
|
||||||
Name: "Hebrew",
|
Name: "Hebrew",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "mrj",
|
Id: "mrj",
|
||||||
Name: "Hill Mari",
|
Name: "Hill Mari",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "hi",
|
Id: "hi",
|
||||||
Name: "Hindi",
|
Name: "Hindi",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "hu",
|
Id: "hu",
|
||||||
Name: "Hungarian",
|
Name: "Hungarian",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "is",
|
Id: "is",
|
||||||
Name: "Icelandic",
|
Name: "Icelandic",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "id",
|
Id: "id",
|
||||||
Name: "Indonesian",
|
Name: "Indonesian",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "ga",
|
Id: "ga",
|
||||||
Name: "Irish",
|
Name: "Irish",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "it",
|
Id: "it",
|
||||||
Name: "Italian",
|
Name: "Italian",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "ja",
|
Id: "ja",
|
||||||
Name: "Japanese",
|
Name: "Japanese",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "jv",
|
Id: "jv",
|
||||||
Name: "Javanese",
|
Name: "Javanese",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "kn",
|
Id: "kn",
|
||||||
Name: "Kannada",
|
Name: "Kannada",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "kazlat",
|
Id: "kazlat",
|
||||||
Name: "Kazakh (Latin)",
|
Name: "Kazakh (Latin)",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "kk",
|
Id: "kk",
|
||||||
Name: "Kazakh",
|
Name: "Kazakh",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "km",
|
Id: "km",
|
||||||
Name: "Khmer",
|
Name: "Khmer",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "ko",
|
Id: "ko",
|
||||||
Name: "Korean",
|
Name: "Korean",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "ky",
|
Id: "ky",
|
||||||
Name: "Kyrgyz",
|
Name: "Kyrgyz",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "lo",
|
Id: "lo",
|
||||||
Name: "Lao",
|
Name: "Lao",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "la",
|
Id: "la",
|
||||||
Name: "Latin",
|
Name: "Latin",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "lv",
|
Id: "lv",
|
||||||
Name: "Latvian",
|
Name: "Latvian",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "lt",
|
Id: "lt",
|
||||||
Name: "Lithuanian",
|
Name: "Lithuanian",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "lb",
|
Id: "lb",
|
||||||
Name: "Luxembourgish",
|
Name: "Luxembourgish",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "mk",
|
Id: "mk",
|
||||||
Name: "Macedonian",
|
Name: "Macedonian",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "mg",
|
Id: "mg",
|
||||||
Name: "Malagasy",
|
Name: "Malagasy",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "ms",
|
Id: "ms",
|
||||||
Name: "Malay",
|
Name: "Malay",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "ml",
|
Id: "ml",
|
||||||
Name: "Malayalam",
|
Name: "Malayalam",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "mt",
|
Id: "mt",
|
||||||
Name: "Maltese",
|
Name: "Maltese",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "mi",
|
Id: "mi",
|
||||||
Name: "Maori",
|
Name: "Maori",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "mr",
|
Id: "mr",
|
||||||
Name: "Marathi",
|
Name: "Marathi",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "mhr",
|
Id: "mhr",
|
||||||
Name: "Mari",
|
Name: "Mari",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "mn",
|
Id: "mn",
|
||||||
Name: "Mongolian",
|
Name: "Mongolian",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "ne",
|
Id: "ne",
|
||||||
Name: "Nepali",
|
Name: "Nepali",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "no",
|
Id: "no",
|
||||||
Name: "Norwegian",
|
Name: "Norwegian",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "pap",
|
Id: "pap",
|
||||||
Name: "Papiamento",
|
Name: "Papiamento",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "fa",
|
Id: "fa",
|
||||||
Name: "Persian",
|
Name: "Persian",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "pl",
|
Id: "pl",
|
||||||
Name: "Polish",
|
Name: "Polish",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "pt-BR",
|
Id: "pt-BR",
|
||||||
Name: "Portuguese (Brazilian)",
|
Name: "Portuguese (Brazilian)",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "pt",
|
Id: "pt",
|
||||||
Name: "Portuguese",
|
Name: "Portuguese",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "pa",
|
Id: "pa",
|
||||||
Name: "Punjabi",
|
Name: "Punjabi",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "ro",
|
Id: "ro",
|
||||||
Name: "Romanian",
|
Name: "Romanian",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "ru",
|
Id: "ru",
|
||||||
Name: "Russian",
|
Name: "Russian",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "gd",
|
Id: "gd",
|
||||||
Name: "Scottish Gaelic",
|
Name: "Scottish Gaelic",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "sr-Latn",
|
Id: "sr-Latn",
|
||||||
Name: "Serbian (Latin)",
|
Name: "Serbian (Latin)",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "sr",
|
Id: "sr",
|
||||||
Name: "Serbian",
|
Name: "Serbian",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "si",
|
Id: "si",
|
||||||
Name: "Sinhalese",
|
Name: "Sinhalese",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "sk",
|
Id: "sk",
|
||||||
Name: "Slovak",
|
Name: "Slovak",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "sl",
|
Id: "sl",
|
||||||
Name: "Slovenian",
|
Name: "Slovenian",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "es",
|
Id: "es",
|
||||||
Name: "Spanish",
|
Name: "Spanish",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "su",
|
Id: "su",
|
||||||
Name: "Sundanese",
|
Name: "Sundanese",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "sw",
|
Id: "sw",
|
||||||
Name: "Swahili",
|
Name: "Swahili",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "sv",
|
Id: "sv",
|
||||||
Name: "Swedish",
|
Name: "Swedish",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "tl",
|
Id: "tl",
|
||||||
Name: "Tagalog",
|
Name: "Tagalog",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "tg",
|
Id: "tg",
|
||||||
Name: "Tajik",
|
Name: "Tajik",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "ta",
|
Id: "ta",
|
||||||
Name: "Tamil",
|
Name: "Tamil",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "tt",
|
Id: "tt",
|
||||||
Name: "Tatar",
|
Name: "Tatar",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "te",
|
Id: "te",
|
||||||
Name: "Telugu",
|
Name: "Telugu",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "th",
|
Id: "th",
|
||||||
Name: "Thai",
|
Name: "Thai",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "tr",
|
Id: "tr",
|
||||||
Name: "Turkish",
|
Name: "Turkish",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "udm",
|
Id: "udm",
|
||||||
Name: "Udmurt",
|
Name: "Udmurt",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "uk",
|
Id: "uk",
|
||||||
Name: "Ukrainian",
|
Name: "Ukrainian",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "ur",
|
Id: "ur",
|
||||||
Name: "Urdu",
|
Name: "Urdu",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "uzbcyr",
|
Id: "uzbcyr",
|
||||||
Name: "Uzbek (Cyrillic)",
|
Name: "Uzbek (Cyrillic)",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "uz",
|
Id: "uz",
|
||||||
Name: "Uzbek",
|
Name: "Uzbek",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "vi",
|
Id: "vi",
|
||||||
Name: "Vietnamese",
|
Name: "Vietnamese",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "cy",
|
Id: "cy",
|
||||||
Name: "Welsh",
|
Name: "Welsh",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "xh",
|
Id: "xh",
|
||||||
Name: "Xhosa",
|
Name: "Xhosa",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "sah",
|
Id: "sah",
|
||||||
Name: "Yakut",
|
Name: "Yakut",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "yi",
|
Id: "yi",
|
||||||
Name: "Yiddish",
|
Name: "Yiddish",
|
||||||
},
|
},
|
||||||
List{
|
List{
|
||||||
Id: "zu",
|
Id: "zu",
|
||||||
Name: "Zulu",
|
Name: "Zulu",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
return ListData
|
return ListData
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ package utils
|
|||||||
// Name string
|
// Name string
|
||||||
// Id string
|
// Id string
|
||||||
//}
|
//}
|
||||||
//// To get new language lists for google yandex and libertranslate.
|
//// To get new language lists for google yandex and libertranslate.
|
||||||
//func LangListGoogle(listType string) []List {
|
//func LangListGoogle(listType string) []List {
|
||||||
// UserAgent, ok := os.LookupEnv("SIMPLYTRANSLATE_USER_AGENT")
|
// UserAgent, ok := os.LookupEnv("SIMPLYTRANSLATE_USER_AGENT")
|
||||||
// if !ok {
|
// if !ok {
|
||||||
@ -42,7 +42,7 @@ package utils
|
|||||||
// for _, r := range gjsonArr {
|
// for _, r := range gjsonArr {
|
||||||
// code := r.Get("code").String()
|
// code := r.Get("code").String()
|
||||||
// name := r.Get("name").String()
|
// name := r.Get("name").String()
|
||||||
//
|
//
|
||||||
// ListData = append(ListData, List{Id: code, Name: name})
|
// ListData = append(ListData, List{Id: code, Name: name})
|
||||||
// }
|
// }
|
||||||
// if listType == "sl" {
|
// if listType == "sl" {
|
||||||
|
78
utils/tts.go
78
utils/tts.go
@ -1,29 +1,29 @@
|
|||||||
package utils
|
package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/base64"
|
||||||
"github.com/carlmjohnson/requests"
|
"github.com/carlmjohnson/requests"
|
||||||
"github.com/google/go-querystring/query"
|
"github.com/google/go-querystring/query"
|
||||||
"os"
|
"os"
|
||||||
"context"
|
|
||||||
"encoding/base64"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type ReversoTTS struct {
|
type ReversoTTS struct {
|
||||||
Id string
|
Id string
|
||||||
Voice string
|
Voice string
|
||||||
}
|
}
|
||||||
|
|
||||||
func TTSGoogle(lang string, text string) string {
|
func TTSGoogle(lang string, text string) string {
|
||||||
type Options struct {
|
type Options struct {
|
||||||
Lang string `url:"tl"`
|
Lang string `url:"tl"`
|
||||||
Text string `url:"q"`
|
Text string `url:"q"`
|
||||||
Client string `url:"client"`
|
Client string `url:"client"`
|
||||||
}
|
}
|
||||||
opt := Options{ lang, text, "tw-ob" }
|
opt := Options{lang, text, "tw-ob"}
|
||||||
v, _ := query.Values(opt)
|
v, _ := query.Values(opt)
|
||||||
|
|
||||||
var file string
|
var file string
|
||||||
url := "https://translate.google.com/translate_tts?"+v.Encode()
|
url := "https://translate.google.com/translate_tts?" + v.Encode()
|
||||||
err := requests.
|
err := requests.
|
||||||
URL(url).
|
URL(url).
|
||||||
ToString(&file).
|
ToString(&file).
|
||||||
@ -37,105 +37,105 @@ func TTSReverso(lang string, text string) string {
|
|||||||
var TTSData = []ReversoTTS{
|
var TTSData = []ReversoTTS{
|
||||||
// http://voice.reverso.net/RestPronunciation.svc/v1/output=json/GetAvailableVoices with randomized deduplication
|
// http://voice.reverso.net/RestPronunciation.svc/v1/output=json/GetAvailableVoices with randomized deduplication
|
||||||
ReversoTTS{
|
ReversoTTS{
|
||||||
Id: "ar",
|
Id: "ar",
|
||||||
Voice: "Mehdi22k",
|
Voice: "Mehdi22k",
|
||||||
},
|
},
|
||||||
ReversoTTS{
|
ReversoTTS{
|
||||||
Id: "zh",
|
Id: "zh",
|
||||||
Voice: "Lulu22k",
|
Voice: "Lulu22k",
|
||||||
},
|
},
|
||||||
ReversoTTS{
|
ReversoTTS{
|
||||||
Id: "cz",
|
Id: "cz",
|
||||||
Voice: "Eliska22k",
|
Voice: "Eliska22k",
|
||||||
},
|
},
|
||||||
ReversoTTS{
|
ReversoTTS{
|
||||||
Id: "dk",
|
Id: "dk",
|
||||||
Voice: "Mette22k",
|
Voice: "Mette22k",
|
||||||
},
|
},
|
||||||
ReversoTTS{
|
ReversoTTS{
|
||||||
Id: "nl",
|
Id: "nl",
|
||||||
Voice: "Daan22k",
|
Voice: "Daan22k",
|
||||||
},
|
},
|
||||||
ReversoTTS{
|
ReversoTTS{
|
||||||
Id: "en",
|
Id: "en",
|
||||||
Voice: "Will22k",
|
Voice: "Will22k",
|
||||||
},
|
},
|
||||||
ReversoTTS{
|
ReversoTTS{
|
||||||
Id: "fr",
|
Id: "fr",
|
||||||
Voice: "Margaux22k",
|
Voice: "Margaux22k",
|
||||||
},
|
},
|
||||||
ReversoTTS{
|
ReversoTTS{
|
||||||
Id: "de",
|
Id: "de",
|
||||||
Voice: "Andreas22k",
|
Voice: "Andreas22k",
|
||||||
},
|
},
|
||||||
ReversoTTS{
|
ReversoTTS{
|
||||||
Id: "gr",
|
Id: "gr",
|
||||||
Voice: "Dimitris22k",
|
Voice: "Dimitris22k",
|
||||||
},
|
},
|
||||||
ReversoTTS{
|
ReversoTTS{
|
||||||
Id: "heb",
|
Id: "heb",
|
||||||
Voice: "he-IL-Asaf",
|
Voice: "he-IL-Asaf",
|
||||||
},
|
},
|
||||||
ReversoTTS{
|
ReversoTTS{
|
||||||
Id: "it",
|
Id: "it",
|
||||||
Voice: "Chiara22k",
|
Voice: "Chiara22k",
|
||||||
},
|
},
|
||||||
ReversoTTS{
|
ReversoTTS{
|
||||||
Id: "jp",
|
Id: "jp",
|
||||||
Voice: "Sakura22k",
|
Voice: "Sakura22k",
|
||||||
},
|
},
|
||||||
ReversoTTS{
|
ReversoTTS{
|
||||||
Id: "kr",
|
Id: "kr",
|
||||||
Voice: "Minji22k",
|
Voice: "Minji22k",
|
||||||
},
|
},
|
||||||
ReversoTTS{
|
ReversoTTS{
|
||||||
Id: "pl",
|
Id: "pl",
|
||||||
Voice: "Monika22k",
|
Voice: "Monika22k",
|
||||||
},
|
},
|
||||||
ReversoTTS{
|
ReversoTTS{
|
||||||
Id: "pt",
|
Id: "pt",
|
||||||
Voice: "Celia22k",
|
Voice: "Celia22k",
|
||||||
},
|
},
|
||||||
ReversoTTS{
|
ReversoTTS{
|
||||||
Id: "ro",
|
Id: "ro",
|
||||||
Voice: "ro-RO-Andrei",
|
Voice: "ro-RO-Andrei",
|
||||||
},
|
},
|
||||||
ReversoTTS{
|
ReversoTTS{
|
||||||
Id: "ru",
|
Id: "ru",
|
||||||
Voice: "Alyona22k",
|
Voice: "Alyona22k",
|
||||||
},
|
},
|
||||||
ReversoTTS{
|
ReversoTTS{
|
||||||
Id: "es",
|
Id: "es",
|
||||||
Voice: "Antonio22k",
|
Voice: "Antonio22k",
|
||||||
},
|
},
|
||||||
ReversoTTS{
|
ReversoTTS{
|
||||||
Id: "se",
|
Id: "se",
|
||||||
Voice: "Erik22k",
|
Voice: "Erik22k",
|
||||||
},
|
},
|
||||||
ReversoTTS{
|
ReversoTTS{
|
||||||
Id: "tr",
|
Id: "tr",
|
||||||
Voice: "Ipek22k",
|
Voice: "Ipek22k",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
// https://voice.reverso.net/RestPronunciation.svc/v1/output=json/GetVoiceStream/voiceName=Lulu22k?voiceSpeed=80&inputText=6K%20V6aqM Base64 input text
|
// https://voice.reverso.net/RestPronunciation.svc/v1/output=json/GetVoiceStream/voiceName=Lulu22k?voiceSpeed=80&inputText=6K%20V6aqM Base64 input text
|
||||||
text2 := base64.StdEncoding.EncodeToString([]byte(text))
|
text2 := base64.StdEncoding.EncodeToString([]byte(text))
|
||||||
var voice string
|
var voice string
|
||||||
for _, s := range TTSData {
|
for _, s := range TTSData {
|
||||||
if s.Id == lang {
|
if s.Id == lang {
|
||||||
voice = s.Voice
|
voice = s.Voice
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type Options struct {
|
type Options struct {
|
||||||
VoiceSpeed int `url:"voiceSpeed"`
|
VoiceSpeed int `url:"voiceSpeed"`
|
||||||
Text string `url:"inputText"`
|
Text string `url:"inputText"`
|
||||||
}
|
}
|
||||||
opt := Options{ 80, text2 }
|
opt := Options{80, text2}
|
||||||
v, _ := query.Values(opt)
|
v, _ := query.Values(opt)
|
||||||
|
|
||||||
var file string
|
var file string
|
||||||
url := "https://voice.reverso.net/RestPronunciation.svc/v1/output=json/GetVoiceStream/voiceName="+voice+"?"+v.Encode()
|
url := "https://voice.reverso.net/RestPronunciation.svc/v1/output=json/GetVoiceStream/voiceName=" + voice + "?" + v.Encode()
|
||||||
|
|
||||||
UserAgent, ok := os.LookupEnv("SIMPLYTRANSLATE_USER_AGENT")
|
UserAgent, ok := os.LookupEnv("SIMPLYTRANSLATE_USER_AGENT")
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -2,6 +2,19 @@
|
|||||||
|
|
||||||
<main>
|
<main>
|
||||||
<h2>SimplyTranslate</h2>
|
<h2>SimplyTranslate</h2>
|
||||||
|
<h3>Translate</h3>
|
||||||
|
|
||||||
|
<form action="/" method="get">
|
||||||
|
<label for="textin">Text To Translate:</label>
|
||||||
|
<textarea id="textin" name="textin" rows="4" cols="50"></textarea>
|
||||||
|
<input type="checkbox" name="vehicle1" value="Bike">
|
||||||
|
<label for="vehicle1"> I have a bike</label><br>
|
||||||
|
<input type="checkbox" name="vehicle2" value="Car">
|
||||||
|
<label for="vehicle2"> I have a car</label><br>
|
||||||
|
<input type="checkbox" name="vehicle3" value="Boat" checked>
|
||||||
|
<label for="vehicle3"> I have a boat</label><br><br>
|
||||||
|
<input type="submit" value="Submit">
|
||||||
|
</form>
|
||||||
<h3>Info</h3>
|
<h3>Info</h3>
|
||||||
{{ if eq .version "unknown, please build with Go 1.13+ or use Git"}} SimplyTranslate
|
{{ if eq .version "unknown, please build with Go 1.13+ or use Git"}} SimplyTranslate
|
||||||
version: <code>unknown</code> {{ else }} SimplyTranslate version:
|
version: <code>unknown</code> {{ else }} SimplyTranslate version:
|
||||||
|
Loading…
Reference in New Issue
Block a user