Skip to content

Commit

Permalink
feat(all): add japanese support (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
ikkz authored Jan 22, 2025
1 parent 2ed9a7b commit c90c477
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/fast-coats-invent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'anki-templates': patch
---

feat(all): add japanese support
2 changes: 1 addition & 1 deletion build/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const items: ConfigItem[] = [
{
key: 'locale',
len: 4,
variants: ['zh', 'en'],
variants: ['zh', 'en', 'ja'],
},
{
key: 'field',
Expand Down
3 changes: 2 additions & 1 deletion src/entries/mcq.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ export default () => {
'after:absolute after:left-px after:top-0 after:block after:-translate-x-full after:rounded-l after:px-0.5 after:py-1 after:text-xs after:text-white':
selectResult !== 'none',
'after:origin-top-right after:scale-75':
selectResult !== 'none' && locale === 'en',
selectResult !== 'none' &&
['en', 'ja'].includes(locale),
'before:text-red-500 after:bg-red-500':
selectResult === 'wrong',
'before:text-green-500 after:bg-green-500':
Expand Down
3 changes: 2 additions & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable @typescript-eslint/no-require-imports */
import en from './translations/en.json';
import ja from './translations/ja.json';
import zh from './translations/zh.json';

/** @type {import('tailwindcss').Config} */
Expand All @@ -21,7 +22,7 @@ module.exports = {
safelist: [
'ABCDEFGHIJ'.split('').map((alpha) => `before:content-['${alpha}']`),
['missedAnswer', 'correctAnswer', 'wrongAnswer']
.map((key) => [zh, en].map((map) => `after:content-['${map[key]}']`))
.map((key) => [zh, en, ja].map((map) => `after:content-['${map[key]}']`))
.flat(),
].flat(),
};
56 changes: 56 additions & 0 deletions translations/ja.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"question": "質問",
"singleAnswer": "単一選択",
"multipleAnswer": "複数選択",
"templateSetting": "設定",
"back": "戻る",
"missingAnswer": "回答が不足しています",
"missingOptions": "選択肢が不足しています",
"answer": "答え",
"about": "概要",
"hideTimer": "タイマーを非表示",
"randomOption": "選択肢をランダム化",
"randomOptionDetail": "有効にすると、選択肢がランダムな順序で表示され、回答を表示すると元の順序に戻ります",
"selMenu": "メニューを選択",
"selMenuDetail": "テキストを選択するとメニューが表示され、クリックすると選択したテキストに関連する情報を確認するために百度翻訳や百度検索などのツールに素早くジャンプできます",
"hideAbout": "ホームの「概要」を非表示",
"biggerText": "大きなテキスト",
"day": "",
"hour": "時間",
"minute": "",
"second": "",
"timerTitle": "タイトル",
"defaultTimerTitle": "年末まであと",
"timerSetting": "タイマー設定",
"timer": "タイマー",
"close": "閉じる",
"setting": "設定",
"targetDate": "目標日付",
"missedAnswer": "未選択",
"correctAnswer": "正解",
"wrongAnswer": "不正解",
"hideQuestionType": "問題タイプ(単一選択/複数選択)を非表示",
"hideQuestionTypeDetail": "現在のカードに正解がいくつあるかを自分で判断する必要があります",
"noScroll": "反転時に自動スクロールしない",
"blurOptions": "選択肢をぼかす",
"blurOptionsDetail": "有効にすると選択肢がぼやけ、選択肢エリアをクリックすると元に戻ります",
"hideMcqAnswer": "裏面の答え(AC/ABC)の表示を非表示",
"yourWrongAnswer": "あたの誤答",
"help": "ヘルプ",
"tool": "ツール",
"add": "追加",
"name": "名前",
"url": "リンク",
"prefixText": "前置テキスト",
"suffixText": "後置テキスト",
"cancel": "キャンセル",
"save": "保存",
"confirmDelete": "削除してもよろしいですか?",
"translate": "翻訳",
"search": "検索",
"explainFollowing": "以下を説明してください: ",
"toolHelp": "<p>各ツールにはURLを設定する必要があります。例えば、Google検索の場合:</p><pre><code>https://www.google.com/search?q={q}</code></pre><p>テキストを選択した後、対応するツールをクリックすると、リンク内の <code>{q}</code> が選択したテキストに置き換えられ、置き換え後のリンクに自動的にジャンプします。</p><p>前置テキストと後置テキストは、選択したテキストの前後に対応するテキストを追加し、それを <code>{q}</code> として置き換えを実行するものです。</p>",
"optionsHint": "Ankiを再起動した後に以前の設定が失われたり、デバイス間で設定を同期したい場合は、以下の設定ページに進んでください",
"optionsPage": "オプション設定",
"optionsHelp": "以下の内容を選択してコピーできます。詳細手順は <a target=\"_blank\" href=\"https://github.com/ikkz/anki-template/blob/main/docs/embed-options.md\">こちら</a> をご覧ください。"
}

0 comments on commit c90c477

Please sign in to comment.