Skip to content

Commit

Permalink
ci & localize
Browse files Browse the repository at this point in the history
  • Loading branch information
tachibana-shin committed Dec 20, 2022
1 parent c3b6917 commit 04c52a2
Show file tree
Hide file tree
Showing 9 changed files with 146 additions and 87 deletions.
6 changes: 4 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@
"• {{ t('_maxPage-trang', [data?.maxPage]) }}\n ",
"• {{ t('_maxPage-trang', [data?.maxPage]) }}\n "
],
"src/apis/runs/ajax/rate.ts": ["${token_name}=${token_value}"]
"src/apis/runs/ajax/rate.ts": ["${token_name}=${token_value}"],
"src/components/errors/cloudflare.vue": [")\n "]
},
"scss.lint.unknownAtRules": "ignore",
"i18n-ally.sourceLanguage": "vi-VN",
"i18n-ally.extract.ignored": [
"•\n {{\n t(\"tap-moi-chieu-vao-_time-_day\", [\n dayjs(\n new Date(\n `${currentDataSeason.update[1]}:${currentDataSeason.update[2]} 1/1/0`\n )\n ).format(\"HH:MM\"),\n currentDataSeason.update[0] === 0\n ? \"chủ nhật\"\n : `thứ ${currentDataSeason.update[0]}`,\n currentDataSeason.update[0] > new Date().getDay() + 1\n ? \"tuần sau\"\n : \"tuần này\",\n ])\n }}\n "
"•\n {{\n t(\"tap-moi-chieu-vao-_time-_day\", [\n dayjs(\n new Date(\n `${currentDataSeason.update[1]}:${currentDataSeason.update[2]} 1/1/0`\n )\n ).format(\"HH:MM\"),\n currentDataSeason.update[0] === 0\n ? \"chủ nhật\"\n : `thứ ${currentDataSeason.update[0]}`,\n currentDataSeason.update[0] > new Date().getDay() + 1\n ? \"tuần sau\"\n : \"tuần này\",\n ])\n }}\n ",
"Urban VPN"
]
}
49 changes: 27 additions & 22 deletions src/components/ScreenError.vue
Original file line number Diff line number Diff line change
@@ -1,36 +1,41 @@
<template>
<div
class="h-full w-full flex items-center text-white text-center q-pa-md flex flex-center q-pa-md">
<component :is="componentErrors[typeError ?? 'unknown'] ?? componentErrors.unknown" :no-image="noImage"
:retry="() => emit('click:retry')" />
class="h-full w-full flex items-center text-white text-center q-pa-md flex flex-center q-pa-md"
>
<component
:is="componentErrors[typeError ?? 'unknown'] ?? componentErrors.unknown"
:no-image="noImage"
:retry="() => emit('click:retry')"
/>
</div>
</template>
<script lang="ts" setup>
import ErrorCloudflare from "./errors/cloudflare.vue"
import ErrorUnknown from "./errors/unknown.vue"
import { computed } from "vue"
const props = defineProps < {
noImage ? : boolean
error ? : Error
} > ()
const emit = defineEmits < {
(name: "click:retry"): void
} > ()
import ErrorCloudflare from "./errors/cloudflare.vue"
import ErrorUnknown from "./errors/unknown.vue"
const componentErrors = {
cloudflare: ErrorCloudflare,
unknown: ErrorUnknown
}
const props = defineProps<{
noImage?: boolean
// eslint-disable-next-line @typescript-eslint/no-explicit-any
error?: any
}>()
const emit = defineEmits<{
(name: "click:retry"): void
}>()
const componentErrors = {
cloudflare: ErrorCloudflare,
unknown: ErrorUnknown,
}
const typeError = computed(() => {
if (!props.error) return null
const typeError = computed(() => {
if (!props.error) return null
if (props.error.data?.includes("<title>Just a moment...</title>"))
return "cloudflare"
if (props.error.data?.includes("<title>Just a moment...</title>"))
return "cloudflare"
return null
})
return null
})
</script>
119 changes: 71 additions & 48 deletions src/components/errors/cloudflare.vue
Original file line number Diff line number Diff line change
@@ -1,84 +1,107 @@
<template>
<div>

<transition-group v-if="!noImage" name="q-transition--fade" tag="div" class="flex items-center justify-center">
<Icon v-if="rand === 0" icon="vscode-icons:file-type-aurelia" width="84" height="84" />

<Icon v-else-if="rand === 1" icon="vscode-icons:file-type-playwright" width="84" height="84" />
<transition-group
v-if="!noImage"
name="q-transition--fade"
tag="div"
class="flex items-center justify-center"
>
<Icon
v-if="rand === 0"
icon="vscode-icons:file-type-aurelia"
width="84"
height="84"
/>

<Icon
v-else-if="rand === 1"
icon="vscode-icons:file-type-playwright"
width="84"
height="84"
/>

<Icon v-else icon="vscode-icons:file-type-ovpn" width="84" height="84" />
</transition-group>


<div class="text-h4 mt-4">
IP của bạn tới từ quốc gia chưa được hỗ trợ
{{ t("ip-cua-ban-toi-tu-quoc-gia-chua-duoc-ho-tro") }}
</div>

<div class="text-h6 text-weight-regular mt-4">
<p class="opacity-40">
Hiện tại AnimeVsub chỉ hỗ trợ các địa chỉ IP tới từ Việt Nam. Nếu bạn
đang không ở Việt Nam hãy sử dụng các dịch vụ VPN để có được địa chỉ IP
từ Việt Nam
{{ t("msg-caption-country-not-support") }}
</p>

<p class="mt-3 text-gray-400 text-weight-medium">
Bạn có thể sử dụng <a
{{ t("ban-co-the-su-dung") }}
<a
href="https://chrome.google.com/webstore/detail/urban-vpn-proxy/eppiocemhmnlbhjplcgkofciiegomcon"
target="_blank" class="text-blue">Urban VPN</a>
là một VPN miễn phí
target="_blank"
class="text-blue"
>Urban VPN</a
>{{ t("la-mot-vpn-mien-phi") }}
</p>

<div v-if="myip">
<span class="text-weight-medium text-gray-500">IP của bạn: </span>
{{ myip.ip }} ({{ myip.country }} <img :src="`https://flagsapi.com/${myip.cc.toUpperCase()}/flat/64.png`" :ratio="1" class="inline h-7" />)
<span class="text-weight-medium text-gray-500"
>{{ t("ip-cua-ban") }}
</span>
{{ myip.ip }} ({{ myip.country }}
<img
:src="`https://flagsapi.com/${myip.cc.toUpperCase()}/flat/64.png`"
:ratio="1"
class="inline h-7"
/>)
</div>
</div>

<q-btn class="q-mt-md" no-caps outline rounded @click="retry" style="color: #00be06">{{ t("thu-lai") }}</q-btn>
<q-btn
class="q-mt-md"
no-caps
outline
rounded
@click="retry"
style="color: #00be06"
>{{ t("thu-lai") }}</q-btn
>
</div>

</template>

<script lang="ts" setup>
import {
useIntervalFn, computedAsync
} from "@vueuse/core"
import { Icon } from "@iconify/vue"
import { useI18n } from "vue-i18n"
import { ref } from "vue"
import { Icon } from "@iconify/vue"
import { computedAsync, useIntervalFn } from "@vueuse/core"
import { get } from "src/logic/http"
import { ref } from "vue"
import { useI18n } from "vue-i18n"
defineProps < {
noImage?: boolean
retry: () => void
} > ()
const {t}= useI18n()
const rand = ref(Math.round(Math.random() * 2))
useIntervalFn(() => {
rand.value = Math.round(Math.random() * 3)
}, 3_000)
const myip = computedAsync<{
ip: string
country: string
cc: string
} | null>(() => {
return fetch("https://api.myip.com/").then(res => {
defineProps<{
noImage?: boolean
retry: () => void
}>()
const { t } = useI18n()
const rand = ref(Math.round(Math.random() * 2))
useIntervalFn(() => {
rand.value = Math.round(Math.random() * 3)
}, 3_000)
const myip = computedAsync<{
ip: string
country: string
cc: string
} | null>(() => {
return fetch("https://api.myip.com/")
.then((res) => {
if (res.ok) return res.json()
return null
})
.catch(() => {
return get({
url: "https://api.myip.com/",
responseType: "json",
}).then(res=>res.data)
}).then((res) => JSON.parse(res.data))
})
}, null)
}, null)
</script>

<style>
</style>
<style></style>
30 changes: 16 additions & 14 deletions src/components/errors/unknown.vue
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
<template>
<div>
<img v-if="!noImage" src="~assets/ic_22_cry.png" width="240" class="mx-auto" />
<img
v-if="!noImage"
src="~assets/ic_22_cry.png"
width="240"
class="mx-auto"
/>
<div style="font-size: 30vh">Error</div>

<div class="text-h2" style="opacity: 0.4">{{ t("da-xay-ra-loi") }}</div>

<q-btn no-caps outline rounded @click="retry" style="color: #00be06">{{ t("thu-lai") }}</q-btn>
<q-btn no-caps outline rounded @click="retry" style="color: #00be06">{{
t("thu-lai")
}}</q-btn>
</div>
</template>

<script lang="ts" setup>
defineProps < {
import { useI18n } from "vue-i18n"
defineProps<{
noImage?: boolean
retry: () => void
}>()
noImage ? : boolean
retry: () => void
} > ()
import {
useI18n
} from "vue-i18n"
const t = useI18n()
const { t } = useI18n()
</script>

<style lang="scss" scoped>
</style>
<style lang="scss" scoped></style>
5 changes: 5 additions & 0 deletions src/i18n/messages/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"app": "App",
"ban-chac-muon-danh-gia-_star-sao-cho-season-nay-chu": "Are you sure you want to rate {0} stars for this season?",
"ban-chi-co-the-danh-gia-mot-lan-cho-moi-season-anime-va-khong-the-sua-lai-sau-khi-danh-gia-hay-chac-chan-rang-ban-cam-thay--b-_text--b": "You can only rate once per Anime season and cannot be re-rated after rating. \nMake sure you feel <span class=\"text-weight-medium\">{0}</span>",
"ban-co-the-su-dung": "You can use",
"ban-da-danh-gia-anime-nay-truoc-day": "You have rated this Anime before",
"ban-dang-muon-doi-relay-khac": "You want to change another relay?",
"ban-van-dang-xem-chu": "Are you still watching?",
Expand Down Expand Up @@ -102,11 +103,14 @@
"hoi-kem": "Slightly less",
"hom-nay": "Today",
"huy": "Cancel",
"ip-cua-ban": "Your IP:",
"ip-cua-ban-toi-tu-quoc-gia-chua-duoc-ho-tro": "Your IP is from an unsupported country",
"kem": "Least",
"khieu-nai-vi-pham": "Complaint of violation",
"khong-co-danh-sach-phat-nao": "No playlists yet",
"khong-co-thong-bao-moi-nao": "No new announcements",
"kiem-tra-cap-nhat": "Check for updates",
"la-mot-vpn-mien-phi": "is a free VPN",
"lich-chieu": "Showtimes",
"lich-su": "History",
"lich-su-xem-anime": "Anime watch history",
Expand All @@ -126,6 +130,7 @@
"mat-khau-moi": "A new password",
"mo-ta": "Describe",
"moi-cap-nhat": "Update",
"msg-caption-country-not-support": "Currently AnimeVsub only supports IP addresses from Vietnam. \nIf you are not in Vietnam use VPN services to get an IP address from Vietnam",
"mua": "Season",
"muc-luc": "Table of contents",
"nam": "Year",
Expand Down
5 changes: 5 additions & 0 deletions src/i18n/messages/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"app": "アプリ",
"ban-chac-muon-danh-gia-_star-sao-cho-season-nay-chu": "今シーズンの {0} つ星を評価してもよろしいですか?",
"ban-chi-co-the-danh-gia-mot-lan-cho-moi-season-anime-va-khong-the-sua-lai-sau-khi-danh-gia-hay-chac-chan-rang-ban-cam-thay--b-_text--b": "評価できるのはアニメ シーズンごとに 1 回だけで、評価後に再評価することはできません。 \n<span class=\"text-weight-medium\">{0}</span> を感じるようにしてください",
"ban-co-the-su-dung": "使用できます",
"ban-da-danh-gia-anime-nay-truoc-day": "このアニメを以前に評価したことがあります",
"ban-dang-muon-doi-relay-khac": "別のリレーを変更しますか?",
"ban-van-dang-xem-chu": "まだ見てますか?",
Expand Down Expand Up @@ -102,11 +103,14 @@
"hoi-kem": "やや少ない",
"hom-nay": "今日",
"huy": "キャンセル",
"ip-cua-ban": "あなたの IP:",
"ip-cua-ban-toi-tu-quoc-gia-chua-duoc-ho-tro": "あなたのIPはサポートされていない国のものです",
"kem": "少しでも",
"khieu-nai-vi-pham": "違反の苦情",
"khong-co-danh-sach-phat-nao": "プレイリストはまだありません",
"khong-co-thong-bao-moi-nao": "新しい発表はありません",
"kiem-tra-cap-nhat": "アップデートを確認",
"la-mot-vpn-mien-phi": "無料のVPNです",
"lich-chieu": "上映時間",
"lich-su": "歴史",
"lich-su-xem-anime": "アニメ視聴履歴",
Expand All @@ -126,6 +130,7 @@
"mat-khau-moi": "新しいパスワード",
"mo-ta": "説明",
"moi-cap-nhat": "アップデート",
"msg-caption-country-not-support": "現在、AnimeVsub はベトナムの IP アドレスのみをサポートしています。\nベトナムにいない場合は、VPN サービスを使用してベトナムから IP アドレスを取得します",
"mua": "シーズン",
"muc-luc": "目次",
"nam": "",
Expand Down
5 changes: 5 additions & 0 deletions src/i18n/messages/vi-VN.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"app": "App",
"ban-chac-muon-danh-gia-_star-sao-cho-season-nay-chu": "Bạn chắc muốn đánh giá {0} sao cho season này chứ?",
"ban-chi-co-the-danh-gia-mot-lan-cho-moi-season-anime-va-khong-the-sua-lai-sau-khi-danh-gia-hay-chac-chan-rang-ban-cam-thay--b-_text--b": "Bạn chỉ có thể đánh giá một lần cho mỗi season Anime và không thể sửa lại sau khi đánh giá. Hãy chắc chắn rằng bạn cảm thấy <span class=\"text-weight-medium\">{0}</span>",
"ban-co-the-su-dung": "Bạn có thể sử dụng",
"ban-da-danh-gia-anime-nay-truoc-day": "Bạn đã đánh giá Anime này trước đây",
"ban-dang-muon-doi-relay-khac": "Bạn đang muốn đổi rơ le khác?",
"ban-van-dang-xem-chu": "Bạn vẫn đang xem chứ",
Expand Down Expand Up @@ -102,11 +103,14 @@
"hoi-kem": "Hơi kém",
"hom-nay": "hôm nay",
"huy": "Hủy",
"ip-cua-ban": "IP của bạn:",
"ip-cua-ban-toi-tu-quoc-gia-chua-duoc-ho-tro": "IP của bạn tới từ quốc gia chưa được hỗ trợ",
"kem": "Kém",
"khieu-nai-vi-pham": "Khiếu nại vi phạm",
"khong-co-danh-sach-phat-nao": "Không có danh sách phát nào",
"khong-co-thong-bao-moi-nao": "Không có thông báo mới nào",
"kiem-tra-cap-nhat": "Kiểm tra cập nhật",
"la-mot-vpn-mien-phi": "là một VPN miễn phí",
"lich-chieu": "Lịch chiếu",
"lich-su": "Lịch sử",
"lich-su-xem-anime": "Lịch sử xem Anime",
Expand All @@ -126,6 +130,7 @@
"mat-khau-moi": "Mật khẩu mới",
"mo-ta": "Mô tả",
"moi-cap-nhat": "Mới cập nhật",
"msg-caption-country-not-support": "Hiện tại AnimeVsub chỉ hỗ trợ các địa chỉ IP tới từ Việt Nam. Nếu bạn đang không ở Việt Nam hãy sử dụng các dịch vụ VPN để có được địa chỉ IP từ Việt Nam",
"mua": "Mùa",
"muc-luc": "Mục lục",
"nam": "Năm",
Expand Down

0 comments on commit 04c52a2

Please sign in to comment.