Skip to content

Commit

Permalink
chore: more localizations
Browse files Browse the repository at this point in the history
  • Loading branch information
hmbanan666 committed Jul 1, 2024
1 parent 5bad9fb commit 107efb5
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 17 deletions.
9 changes: 6 additions & 3 deletions src/lib/components/Footer.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<script>
import { config } from '$lib/config'
import { page } from '$app/stores'
const t = $page.data.t
</script>

<footer>
<ul>
<li>
<a href={config.githubRepoUrl} target='_blank'>Код на GitHub</a>
<a href={config.githubRepoUrl} target='_blank'>{t.footer.github}</a>
</li>
<li>
<a href={config.discordServerInviteUrl} target='_blank'>Discord</a>
Expand All @@ -14,11 +17,11 @@
<a href={config.twitch.url} target='_blank'>Twitch</a>
</li>
<li>
<a href={config.donateUrl} target='_blank'>Донат</a>
<a href={config.donateUrl} target='_blank'>{t.footer.donate}</a>
</li>
</ul>

<p>Создается с трепетом и ❤️</p>
<p>{t.footer.text}</p>
</footer>

<style>
Expand Down
1 change: 0 additions & 1 deletion src/lib/components/Locale.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
.select-lang {
padding: 0.25em 0.35em 0.25em 0.25em;
background-color: var(--color-background-2);
display: flex;
flex-direction: row;
align-items: center;
Expand Down
11 changes: 6 additions & 5 deletions src/lib/components/Profile.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import twitchIcon from '$lib/assets/website/icons/twitch/112.png'
import { config } from '$lib/config'
const t = $page.data.t
const url = new URL('https://id.twitch.tv/oauth2/authorize')
url.searchParams.set('client_id', config.twitch.clientId)
url.searchParams.set('redirect_uri', config.signInRedirectUrl)
Expand Down Expand Up @@ -42,9 +44,9 @@
</button>
{#if menuOpened}
<div class='dropdown-menu position-left'>
<a href='/{$page.data.locale}/p/{$page.data.profile.userName}'>Профиль</a>
<a href='/{$page.data.locale}/play'>Играть</a>
<button onclick={handleSignOut}>Выйти</button>
<a href='/{$page.data.locale}/p/{$page.data.profile.userName}'>{t.profile.link}</a>
<a href='/{$page.data.locale}/play'>{t.profile.play}</a>
<button onclick={handleSignOut}>{t.profile.signOut}</button>
</div>
{/if}
{:else}
Expand Down Expand Up @@ -77,8 +79,7 @@
padding: 4px;
width: 58px;
height: 58px;
background-image: linear-gradient(to top, #a18cd1 0%, #fbc2eb 100%);
border: 2px solid var(--color-border);
background-color: var(--color-background-2);
transition: all 0.2s;
}
Expand Down
14 changes: 10 additions & 4 deletions src/lib/styles/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -129,22 +129,28 @@ button:focus:not(:focus-visible) {
}

.dropdown-menu {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 0.25em;
width: max-content;
max-width: 320px;
position: absolute;
bottom: -0.25em;
transform: translateY(100%);
padding: 0.5em;
background-color: var(--color-background-2);
}

.dropdown-menu button:not(:last-child), .dropdown-menu a:not(:last-child) {
margin-bottom: 0.25em;
}

.dropdown-menu a {
color: inherit;
text-decoration: none;
}

.dropdown-menu button {
text-align: left;
}

.dropdown-menu button:hover, .dropdown-menu a:hover {
color: var(--color-accent-1);
}
12 changes: 10 additions & 2 deletions src/lib/translations/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ export type Dictionary = typeof en

export const en = {
about: undefined,
character: undefined,
profile: {
link: 'My profile',
play: 'Play',
signOut: 'Sign out',
},
error: {
404: 'Page not found.',
500: 'Server internal error.',
Expand All @@ -17,5 +21,9 @@ export const en = {
coupon: 'Coupon',
},
},
home: undefined,
footer: {
text: 'Created with thrill and ❤️',
github: 'Source on GitHub',
donate: 'Donate',
},
}
12 changes: 10 additions & 2 deletions src/lib/translations/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import type { Dictionary } from '$lib/translations/en'

export const ru = {
about: undefined,
character: undefined,
profile: {
link: 'Мой профиль',
play: 'Играть',
signOut: 'Выйти',
},
error: {
404: 'Страница не найдена.',
500: 'Произошла ошибка на сервере.',
Expand All @@ -17,5 +21,9 @@ export const ru = {
coupon: 'Купон',
},
},
home: undefined,
footer: {
text: 'Создается с трепетом и ❤️',
github: 'Код на GitHub',
donate: 'Донат',
},
} satisfies Dictionary

0 comments on commit 107efb5

Please sign in to comment.