Skip to content

Commit

Permalink
Merge pull request #10 from uros-5/i18n
Browse files Browse the repository at this point in the history
Added starting point for 18n
  • Loading branch information
uros-5 authored Jun 19, 2023
2 parents 5dd7287 + bb22863 commit 5c85cb8
Show file tree
Hide file tree
Showing 20 changed files with 195 additions and 95 deletions.
9 changes: 5 additions & 4 deletions app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,23 @@ useHead({
link: [
{
rel: "stylesheet",
href: "https://fonts.googleapis.com/css2?family=Roboto:wght@300&display=swap",
href:
"https://fonts.googleapis.com/css2?family=Roboto:wght@300&display=swap"
},
{ rel: "stylesheet", href: "/chessground.css" },
{ rel: "stylesheet", href: "/standard.css" },
{ rel: "stylesheet", href: "/extensions.css" },
{ rel: "stylesheet", href: "/style.css" },
{ rel: "stylesheet", href: "/site.css" },
{ rel: "stylesheet", href: "/lobby.css" },
{ rel: "stylesheet", href: "/news.css" },
],
{ rel: "stylesheet", href: "/news.css" }
]
});
useSeoMeta({
ogImage: "/lishuuro-tile-wide.png",
twitterImage: "/lishuuro-tile.png",
twitterCard: "summary",
twitterCard: "summary"
});
const route = useRoute();
Expand Down
Binary file added assets/sounds/buy.ogg
Binary file not shown.
10 changes: 5 additions & 5 deletions components/Article.client.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<span class="text">
<NuxtLink :to="`/@/${props.user}`">
@{{ props.user }}
</NuxtLink></span
>
</NuxtLink>
</span>
<span class="text"> {{ props.category }} </span>
</div>
<div class="headline">
Expand Down Expand Up @@ -42,9 +42,9 @@ onMounted(() => {
let id = useRoute().params.id;
let item = newsStore.exist(id as string);
if (!item) {
GET(`news/${id}`).then((value: any) => {
if (value.data.exist) {
let data = NewsItem.parse(value.data.news);
GET(`news/${id}`).then((res: any) => {
if (res.data.exist) {
let data = NewsItem.parse(res.data.news);
props.value = data;
useHead({
title: "Lishuuro",
Expand Down
2 changes: 1 addition & 1 deletion components/ChatRoom.client.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { ref } from "vue";
import { useUser } from "stores/useUser";
import { useWs } from "stores/useWs";
import type { ChatMessage } from "stores/useChat";
import { useCookies } from "@vueuse/integrations";
import { useCookies } from "@vueuse/integrations/useCookies";
const { SEND } = useWs();
Expand Down
2 changes: 1 addition & 1 deletion components/HeaderAccount.client.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="site-buttons">
<div class="site-buttons text-2xl">
<div id="username">
<NuxtLink class="user-link" :to="`/@/${user.username}`">{{
user.username
Expand Down
10 changes: 5 additions & 5 deletions components/NewsArticle.client.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<span class="text">
<NuxtLink :to="`/@/${props.user}`">
@{{ props.user }}
</NuxtLink></span
>
</NuxtLink>
</span>
<span class="text"> {{ props.category }} </span>
</div>
<div class="headline">
Expand Down Expand Up @@ -42,9 +42,9 @@ onMounted(() => {
let id = useRoute().params.id;
let item = newsStore.exist(id as string);
if (!item) {
GET(`news/${id}`).then((value: any) => {
if (value.data.exist) {
let data = NewsItem.parse(value.data.news);
GET(`news/${id}`).then((res: any) => {
if (res.data.exist) {
let data = NewsItem.parse(res.data.value.news);
props.value = data;
useHead({
title: "Article",
Expand Down
9 changes: 2 additions & 7 deletions components/ShuuroShop.client.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,8 @@
</span>
</p>
</div>
<PlayerHand
side=""
:in-center="true"
:counter="[1, 0, 0, 0, 0, 0, 0, 0]"
:color="getColor(user.username)"
hand-type="shop"
/>
<PlayerHand side="" :in-center="true" :counter="[1, 0, 0, 0, 0, 0, 0, 0]" :color="getColor(user.username)"
hand-type="shop" />
<p class="local-credit">Credit: {{ myCredit() }}</p>
<button class="shuuro-confirm" @click="shopStore.confirm()">Confirm</button>
</div>
Expand Down
35 changes: 7 additions & 28 deletions components/ShuuroStageInfo.client.vue
Original file line number Diff line number Diff line change
@@ -1,37 +1,16 @@
<template>
<div class="game-info">
<section>
<ShuuroStageMatchInfo
:variant="gameStore.state.variant"
:minute="gameStore.state.min"
:sec="gameStore.state.incr"
:rated="false"
date="*"
/>
<ShuuroLeftSideUsername
:player_username="player(0)"
:rating="rating(player(0))"
color="white"
/>
<ShuuroLeftSideUsername
:player_username="player(1)"
:rating="rating(player(1))"
color="black"
/>
<ShuuroStageMatchInfo :variant="gameStore.state.variant" :minute="gameStore.state.min" :sec="gameStore.state.incr"
:rated="false" date="*" />
<ShuuroLeftSideUsername :player_username="player(0)" :rating="rating(player(0))" color="white" />
<ShuuroLeftSideUsername :player_username="player(1)" :rating="rating(player(1))" color="black" />
</section>
<section class="shuuro-navigator">
<NuxtLink
class="user-link"
v-if="gameStore.state.sub_variant == 100"
:to="navRoute('0')"
>
Shop
<NuxtLink class="user-link" v-if="gameStore.state.sub_variant == 100" :to="navRoute('0')">
Selection
</NuxtLink>
<NuxtLink
class="user-link"
v-if="!isFightSubVariant()"
:to="navRoute('1')"
>
<NuxtLink class="user-link" v-if="!isFightSubVariant()" :to="navRoute('1')">
Deploy
</NuxtLink>
<NuxtLink class="user-link" :to="navRoute('2')"> Fight </NuxtLink>
Expand Down
5 changes: 0 additions & 5 deletions components/TvGame.client.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
</template>

<script setup lang="ts">
defineProps<{
w: string;
b: string;
Expand Down
12 changes: 4 additions & 8 deletions components/UserProfile.client.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@
</div>
<table id="games">
<tbody ref="scrollComponent">
<UserProfileGame
v-for="g in games"
v-bind:key="g._id"
:game="g"
/>
<UserProfileGame v-for="g in games" v-bind:key="g._id" :game="g" />
</tbody>
</table>
</div>
Expand Down Expand Up @@ -58,10 +54,10 @@ function newGames(id: string, page: number) {
if (!exist.value) {
return;
}
GET(`games/${id}/${page}`).then((value: any) => {
let data = Response.parse(value.data);
GET(`games/${id}/${page}`).then((res: any) => {
let data = Response.parse(JSON.parse(res.data.value));
if (data.exist == true) {
games.value.push(...value.data.games);
games.value.push(...data.games!);
exist.value = true;
} else {
exist.value = false;
Expand Down
30 changes: 7 additions & 23 deletions components/UserProfileGame.client.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,8 @@
<NuxtLink :to="gameUrl(game._id, game.current_stage, game.status)">
<td class="board invisible">
<div class="standard" :class="`${isStandard()}`">
<div
ref="element"
:class="`chessground12 mini ${game._id}`"
:id="game._id"
:data-board="settings.getBoard()"
:data-piece="settings.getPiece()"
:data-size="settings.getVariant(game.variant)"
/>
<div ref="element" :class="`chessground12 mini ${game._id}`" :id="game._id" :data-board="settings.getBoard()"
:data-piece="settings.getPiece()" :data-size="settings.getVariant(game.variant)" />
</div>
</td>
<td class="games-info">
Expand All @@ -30,25 +24,15 @@
<div class="info-middle">
<div class="versus">
<player>
<NuxtLink
:key="useRoute().fullPath"
class="user-link"
:to="`/@/${props.game.players[0]}`"
><player-title> </player-title
>{{ props.game.players[0] }}</NuxtLink
>
<NuxtLink :key="useRoute().fullPath" class="user-link" :to="`/@/${props.game.players[0]}`"><player-title>
</player-title>{{ props.game.players[0] }}</NuxtLink>
<br />
1500?
</player>
<vs-swords class="icon" :data-icon="sword"></vs-swords>
<player>
<NuxtLink
:key="useRoute().fullPath"
class="user-link"
:to="`/@/${props.game.players[1]}`"
><player-title> </player-title
>{{ props.game.players[1] }}</NuxtLink
>
<NuxtLink :key="useRoute().fullPath" class="user-link" :to="`/@/${props.game.players[1]}`"><player-title>
</player-title>{{ props.game.players[1] }}</NuxtLink>
<br />
1500?
</player>
Expand Down Expand Up @@ -234,7 +218,7 @@ div.info-middle {
}
.chessground12 cg-board {
background-image: url("board/12x12brown.svg");
background-image: url("/board/12x12brown.svg");
}
.cg-wrap.mini {
Expand Down
56 changes: 56 additions & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"header": {
"currentGames": "Current games",
"tournaments": "Tournaments",
"login": "log in",
"sound": "Sound",
"background": "Background",
"boardSettings": "Board Settings",
"light": "Light",
"dark": "Dark"
},
"home": {
"introduction": "Introduction",
"lobbyTable": {
"player": "Player",
"rating": "Rating",
"time": "Time",
"variant": "Variant"
},
"variant": "Variant",
"minutesPerSide": "Minutes per side",
"incrementInSeconds": "Increment in seconds",
"donate": "Donate",
"players": "players",
"gamesInPlay": "games in play",
"latestUpdated": "Latest updated"
},
"tv": {
"empty": "There are no available games at the moment."
},
"tournaments": {
"empty": "There are no available tournaments at the moment."
},
"userProfile": {
"games": "Games",
"gamesWithYou": "Games with you",
"rated": "Rated",
"imported": "Imported",
"moves": "moves"
},
"game": {
"analysisBoard": "Analysis Board",
"Selection": "Selection",
"Deploy": "Deploy",
"Fight": "Fight",
"shop": {
"credit": "Credit",
"Confirm": "Confirm"
}
},
"chat": {
"chatRoom": "Chat room",
"signInToChat": "Sign in to chat",
"oldGames": "Chat disabled for old games"
}
}
10 changes: 10 additions & 0 deletions lang/i18n.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export default defineI18nConfig(() => ({
legacy: false,
locale: 'en',
messages: {
en: {credit: "Credit"},
sr: {credit: "crREdit"}
// en: en(),
// fr: fr()
}
}))
22 changes: 22 additions & 0 deletions lang/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import json
import os

with open("en.json", "r") as real:
real = json.loads(real.read())
newer = {}
for key in real.keys():
print(key + "\n")
obj = {}
for key2 in real[key]:
if "str" in str(type(key2)):
new_input = input(f"{key2}>>>")
obj[key2] = str(new_input)
else:
obj[key][key2] = {}
for key3 in real[key][key2]:
new_input = input(f"{key3}>>>")
obj[key][key2] = str(new_input)
newer[key] = obj
with open("lang.json", "w") as real2:
converted = json.dumps(newer)
real2.write(converted)
56 changes: 56 additions & 0 deletions lang/rs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"header": {
"currentGames": "Тренутни мечеви",
"tournaments": "Турнири",
"login": "Пријави се",
"sound": "Звук",
"background": "Позадина",
"boardSettings": "Подешавање табле",
"light": "Светлија",
"dark": "Мрачнија"
},
"lobbyTable": {
"player": "Играч",
"rating": "Рејтинг",
"time": "Време",
"variant": "Варијанта"
},
"home": {
"introduction": "Увод",
"variant": "Варијанта",
"minutesPerSide": "Минути",
"incrementInSeconds": "Додатак у секундама",
"donate": "Донирај",
"players": "Играчи",
"gamesInPlay": "мечева у току",
"latestUpdated": "Најновије вести"
},
"tv": {
"empty": "Тренутно нема активних мечева."
},
"tournaments": {
"empty": "Тренутно нема активних турнира."
},
"userProfile": {
"games": "Мечеви",
"gamesWithYou": "Мечеви са тобом",
"rated": "Оцењене",
"imported": "Уведене",
"moves": "потеза"
},
"game": {
"analysisBoard": "Анализа меча",
"Selection": "Селекција",
"Deploy": "Поставка",
"Fight": "Меч"
},
"shop": {
"credit": "Кредит",
"Confirm": "Потврди"
},
"chat": {
"chatRoom": "Ћаскање",
"signInToChat": "Пријави се да би ћаскао.",
"oldGames": "оступно за готове партије."
}
}
Loading

0 comments on commit 5c85cb8

Please sign in to comment.