mirror of https://github.com/FreeTubeApp/FreeTube
Localize proxy test info when possible (#4255)
* Localize proxy test info when possible * Use a second find in-case a locale with the same language is added in the future Co-authored-by: Jason <84899178+jasonhenriquez@users.noreply.github.com> * Fix syntax error Co-authored-by: PikachuEXE <pikachuexe@gmail.com> --------- Co-authored-by: Jason <84899178+jasonhenriquez@users.noreply.github.com> Co-authored-by: PikachuEXE <pikachuexe@gmail.com>
This commit is contained in:
parent
a6cdd4b1b1
commit
7304d75239
|
@ -29,7 +29,6 @@ export default defineComponent({
|
|||
return {
|
||||
isLoading: false,
|
||||
dataAvailable: false,
|
||||
proxyTestUrl: 'https://ipwho.is/?output=json&fields=ip,country,city,region',
|
||||
proxyIp: '',
|
||||
proxyCountry: '',
|
||||
proxyRegion: '',
|
||||
|
@ -64,6 +63,22 @@ export default defineComponent({
|
|||
},
|
||||
proxyUrl: function () {
|
||||
return `${this.proxyProtocol}://${this.proxyHostname}:${this.proxyPort}`
|
||||
},
|
||||
lang: function() {
|
||||
return this.$i18n.locale.replace('_', '-')
|
||||
},
|
||||
localeToUse: function() {
|
||||
// locales found here: https://ipwhois.io/documentation
|
||||
const supportedLangs = ['en', 'ru', 'de', 'es', 'pt-BR', 'fr', 'zh-CN', 'ja']
|
||||
return supportedLangs.find(lang => this.lang === lang) ?? supportedLangs.find(lang => this.lang.substring(0, 2) === lang.substring(0, 2))
|
||||
},
|
||||
proxyTestUrl: function() {
|
||||
let proxyTestUrl = 'https://ipwho.is/?output=json&fields=ip,country,city,region'
|
||||
if (this.localeToUse) {
|
||||
proxyTestUrl += `&lang=${this.localeToUse}`
|
||||
}
|
||||
|
||||
return proxyTestUrl
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
|
|
Loading…
Reference in New Issue