Skip to content

Commit

Permalink
Add error translate
Browse files Browse the repository at this point in the history
  • Loading branch information
Zokhoi committed Sep 29, 2024
1 parent 9a0a0da commit b53185b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions framerail/src/lib/defaults.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
const defaults = {
fallbackLocale: "en",
translateKeys: {
// Error
"error": {},

// Footer
"footer-powered-by": {},
"terms": {},
Expand Down
7 changes: 5 additions & 2 deletions framerail/src/lib/popup/error.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<script lang="ts">
export let exitPrompt: () => void
import { onMount, onDestroy } from "svelte"
import { page } from "$app/stores"
import { useErrorPopup } from "$lib/stores"
let showErrorPopup = useErrorPopup()
function containerExitPrompt(e: Event) {
if ((e.target as HTMLElement).classList.contains("modal-container")) exitPrompt()
}
const escKeydown = (e) => {
const escKeydown = (e: KeyboardEvent) => {
if (e.code.toLowerCase() === "escape") exitPrompt()
}
onMount(() => {
Expand All @@ -26,7 +27,9 @@
on:keydown={escKeydown}
>
<div class="modal error-modal">
<h2 id="modal-title">UT: Error</h2>
<h2 id="modal-title">
{($page.data.internationalization ?? $page.error?.internationalization)?.error}
</h2>
<div id="modal-message" class="modal-message">
{$showErrorPopup.message}
</div>
Expand Down
1 change: 1 addition & 0 deletions locales/fluent/base/en.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ docs = Docs
download = Download
edit = Edit
editor = Editor
error = Error
footer = Page Footer
general = General
header = Page Header
Expand Down
1 change: 1 addition & 0 deletions locales/fluent/base/zh_Hans.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ docs = 文档
download = 下载
edit = 编辑
editor = 编辑器
error = 错误
footer = 页脚
general = 通用
header = 页眉
Expand Down

0 comments on commit b53185b

Please sign in to comment.