From 1b8c90e2be968bb3cfec1f700a34743bf1d37768 Mon Sep 17 00:00:00 2001 From: Riffaells Date: Sun, 1 Dec 2024 13:50:40 +0500 Subject: [PATCH] creating future localizations, and adding readme --- README.md | 111 ++++++++++----------------------------- README_RU.md | 48 +++++++++++++++++ src/lang/helper.ts | 63 +++++++++++++++++++++- src/lang/locale/ar.ts | 3 ++ src/lang/locale/bn.ts | 2 + src/lang/locale/cz.ts | 2 + src/lang/locale/da.ts | 3 ++ src/lang/locale/de.ts | 2 + src/lang/locale/en-gb.ts | 3 ++ src/lang/locale/es.ts | 3 ++ src/lang/locale/fr.ts | 2 + src/lang/locale/hi.ts | 2 + src/lang/locale/id.ts | 3 ++ src/lang/locale/it.ts | 3 ++ src/lang/locale/ja.ts | 3 ++ src/lang/locale/ko.ts | 3 ++ src/lang/locale/mr.ts | 2 + src/lang/locale/nl.ts | 2 + src/lang/locale/no.ts | 3 ++ src/lang/locale/pl.ts | 2 + src/lang/locale/pt-br.ts | 3 ++ src/lang/locale/pt.ts | 2 + src/lang/locale/ro.ts | 3 ++ src/lang/locale/sw.ts | 3 ++ src/lang/locale/ta.ts | 3 ++ src/lang/locale/te.ts | 3 ++ src/lang/locale/th.ts | 2 + src/lang/locale/tr.ts | 3 ++ src/lang/locale/uk.ts | 3 ++ src/lang/locale/ur.ts | 3 ++ src/lang/locale/vi.ts | 3 ++ src/lang/locale/zh-cn.ts | 3 ++ src/lang/locale/zh-tw.ts | 3 ++ src/styles.scss | 4 +- 34 files changed, 219 insertions(+), 87 deletions(-) create mode 100644 README_RU.md create mode 100644 src/lang/locale/ar.ts create mode 100644 src/lang/locale/bn.ts create mode 100644 src/lang/locale/cz.ts create mode 100644 src/lang/locale/da.ts create mode 100644 src/lang/locale/de.ts create mode 100644 src/lang/locale/en-gb.ts create mode 100644 src/lang/locale/es.ts create mode 100644 src/lang/locale/fr.ts create mode 100644 src/lang/locale/hi.ts create mode 100644 src/lang/locale/id.ts create mode 100644 src/lang/locale/it.ts create mode 100644 src/lang/locale/ja.ts create mode 100644 src/lang/locale/ko.ts create mode 100644 src/lang/locale/mr.ts create mode 100644 src/lang/locale/nl.ts create mode 100644 src/lang/locale/no.ts create mode 100644 src/lang/locale/pl.ts create mode 100644 src/lang/locale/pt-br.ts create mode 100644 src/lang/locale/pt.ts create mode 100644 src/lang/locale/ro.ts create mode 100644 src/lang/locale/sw.ts create mode 100644 src/lang/locale/ta.ts create mode 100644 src/lang/locale/te.ts create mode 100644 src/lang/locale/th.ts create mode 100644 src/lang/locale/tr.ts create mode 100644 src/lang/locale/uk.ts create mode 100644 src/lang/locale/ur.ts create mode 100644 src/lang/locale/vi.ts create mode 100644 src/lang/locale/zh-cn.ts create mode 100644 src/lang/locale/zh-tw.ts diff --git a/README.md b/README.md index c773152..dcbe733 100644 --- a/README.md +++ b/README.md @@ -1,94 +1,41 @@ -# Obsidian Sample Plugin +# ChessMate Plugin for Obsidian -This is a sample plugin for Obsidian (https://obsidian.md). +**ChessMate Plugin** is a plugin for [Obsidian](https://obsidian.md) that enables displaying chess games and positions in PGN and FEN formats directly within your notes. The plugin uses the `lichess-pgn-viewer` library to render boards and pieces. -This project uses TypeScript to provide type checking and documentation. -The repo depends on the latest plugin API (obsidian.d.ts) in TypeScript Definition format, which contains TSDoc comments describing what it does. +--- -This sample plugin demonstrates some of the basic functionality the plugin API can do. -- Adds a ribbon icon, which shows a Notice when clicked. -- Adds a command "Open Sample Modal" which opens a Modal. -- Adds a plugin setting tab to the settings page. -- Registers a global click event and output 'click' to the console. -- Registers a global interval which logs 'setInterval' to the console. +## Features -## First time developing plugins? +- **Display Chess Games**: + Use code blocks with the `chessmate` type to visualize chess games in PGN format. -Quick starting guide for new plugin devs: +- **Customizable Display**: + Supports configuration for board themes, piece styles, and board size. -- Check if [someone already developed a plugin for what you want](https://obsidian.md/plugins)! There might be an existing plugin similar enough that you can partner up with. -- Make a copy of this repo as a template with the "Use this template" button (login to GitHub if you don't see it). -- Clone your repo to a local development folder. For convenience, you can place this folder in your `.obsidian/plugins/your-plugin-name` folder. -- Install NodeJS, then run `npm i` in the command line under your repo folder. -- Run `npm run dev` to compile your plugin from `main.ts` to `main.js`. -- Make changes to `main.ts` (or create new `.ts` files). Those changes should be automatically compiled into `main.js`. -- Reload Obsidian to load the new version of your plugin. -- Enable plugin in settings window. -- For updates to the Obsidian API run `npm update` in the command line under your repo folder. +- **Chess Notation Support**: + Replay and study games with textual annotations and comments. -## Releasing new releases +--- -- Update your `manifest.json` with your new version number, such as `1.0.1`, and the minimum Obsidian version required for your latest release. -- Update your `versions.json` file with `"new-plugin-version": "minimum-obsidian-version"` so older versions of Obsidian can download an older version of your plugin that's compatible. -- Create new GitHub release using your new version number as the "Tag version". Use the exact version number, don't include a prefix `v`. See here for an example: https://github.com/obsidianmd/obsidian-sample-plugin/releases -- Upload the files `manifest.json`, `main.js`, `styles.css` as binary attachments. Note: The manifest.json file must be in two places, first the root path of your repository and also in the release. -- Publish the release. +## Installation -> You can simplify the version bump process by running `npm version patch`, `npm version minor` or `npm version major` after updating `minAppVersion` manually in `manifest.json`. -> The command will bump version in `manifest.json` and `package.json`, and add the entry for the new version to `versions.json` +### Manual Installation +1. Download the `manifest.json`, `main.js`, and `styles.css` files from the latest release in the [repository](#). +2. Place them in the `.obsidian/plugins/chessmate-plugin/` folder of your vault. +3. Reload Obsidian and activate the plugin in **Settings > Community Plugins**. -## Adding your plugin to the community plugin list +--- -- Check the [plugin guidelines](https://docs.obsidian.md/Plugins/Releasing/Plugin+guidelines). -- Publish an initial version. -- Make sure you have a `README.md` file in the root of your repo. -- Make a pull request at https://github.com/obsidianmd/obsidian-releases to add your plugin. +## Usage -## How to use - -- Clone this repo. -- Make sure your NodeJS is at least v16 (`node --version`). -- `npm i` or `yarn` to install dependencies. -- `npm run dev` to start compilation in watch mode. - -## Manually installing the plugin - -- Copy over `main.js`, `styles.css`, `manifest.json` to your vault `VaultFolder/.obsidian/plugins/your-plugin-id/`. - -## Improve code quality with eslint (optional) -- [ESLint](https://eslint.org/) is a tool that analyzes your code to quickly find problems. You can run ESLint against your plugin to find common bugs and ways to improve your code. -- To use eslint with this project, make sure to install eslint from terminal: - - `npm install -g eslint` -- To use eslint to analyze this project use this command: - - `eslint main.ts` - - eslint will then create a report with suggestions for code improvement by file and line number. -- If your source code is in a folder, such as `src`, you can use eslint with this command to analyze all files in that folder: - - `eslint .\src\` - -## Funding URL - -You can include funding URLs where people who use your plugin can financially support it. - -The simple way is to set the `fundingUrl` field to your link in your `manifest.json` file: - -```json -{ - "fundingUrl": "https://buymeacoffee.com" -} -``` - -If you have multiple URLs, you can also do: - -```json -{ - "fundingUrl": { - "Buy Me a Coffee": "https://buymeacoffee.com", - "GitHub Sponsor": "https://github.com/sponsors", - "Patreon": "https://www.patreon.com/" - } -} -``` - -## API Documentation - -See https://github.com/obsidianmd/obsidian-api +### Displaying a Chess Game +Insert the following example into your note: +```markdown +```chessmate +[Event "Example Game"] +[Site "Obsidian"] +[Date "2024.12.01"] +[Round "?"] +[White "Player1"] +[Black "Player2"] +1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Ba4 Nf6 5. O-O Be7 6. Re1 b5 diff --git a/README_RU.md b/README_RU.md new file mode 100644 index 0000000..6d8b528 --- /dev/null +++ b/README_RU.md @@ -0,0 +1,48 @@ +# ChessMate Plugin для Obsidian + +**ChessMate Plugin** — это плагин для [Obsidian](https://obsidian.md), который позволяет отображать шахматные партии и позиции в формате PGN и FEN прямо в ваших заметках. Плагин использует библиотеку `lichess-pgn-viewer` для рендеринга доски и фигур. + +--- + +## Возможности + +- **Отображение шахматных партий**: + Используйте кодовые блоки с типом `chessmate`, чтобы визуализировать шахматные партии в формате PGN. + +- **Кастомизация отображения**: + Поддерживаются настройки темы доски, фигур и размера. + +- **Поддержка шахматной нотации**: + Воспроизводите и изучайте партии, добавляя текстовые аннотации и комментарии. + +--- + +## Установка + +### Автоматическая установка через менеджер плагинов Obsidian +1. Перейдите в раздел **Settings > Community Plugins**. +2. Нажмите **Browse** и найдите "ChessMate Plugin". +3. Установите и активируйте плагин. + +### Ручная установка +1. Скачайте файлы `manifest.json`, `main.js` и `styles.css` из последнего релиза в [репозитории](#). +2. Поместите их в папку `.obsidian/plugins/chessmate-plugin/` вашего хранилища. +3. Перезагрузите Obsidian и активируйте плагин в разделе **Settings > Community Plugins**. + +--- + +## Использование + +### Отображение шахматной партии +Вставьте в вашу заметку следующий пример: +```` +```chessmate +[Event "Пример партии"] +[Site "Obsidian"] +[Date "2024.12.01"] +[Round "?"] +[White "Player1"] +[Black "Player2"] +1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Ba4 Nf6 5. O-O Be7 6. Re1 b5 +``` +```` diff --git a/src/lang/helper.ts b/src/lang/helper.ts index fb0efbb..930f866 100644 --- a/src/lang/helper.ts +++ b/src/lang/helper.ts @@ -5,12 +5,71 @@ import { moment } from "obsidian"; import en from "src/lang/locale/en"; import ru from "src/lang/locale/ru"; +import ar from "src/lang/locale/ar"; +import bn from "src/lang/locale/bn"; +import cz from "src/lang/locale/cz"; +import da from "src/lang/locale/da"; +import de from "src/lang/locale/de"; +import en_gb from "src/lang/locale/en-gb"; +import es from "src/lang/locale/es"; +import fr from "src/lang/locale/fr"; +import hi from "src/lang/locale/hi"; +import id from "src/lang/locale/id"; +import it from "src/lang/locale/it"; +import ja from "src/lang/locale/ja"; +import ko from "src/lang/locale/ko"; +import mr from "src/lang/locale/mr"; +import nl from "src/lang/locale/nl"; +import no from "src/lang/locale/no"; +import pl from "src/lang/locale/pl"; +import pt_br from "src/lang/locale/pt-br"; +import pt from "src/lang/locale/pt"; +import ro from "src/lang/locale/ro"; +import sw from "src/lang/locale/sw"; +import ta from "src/lang/locale/ta"; +import te from "src/lang/locale/te"; +import th from "src/lang/locale/th"; +import tr from "src/lang/locale/tr"; +import uk from "src/lang/locale/uk"; +import ur from "src/lang/locale/ur"; +import vi from "src/lang/locale/vi"; +import zh_cn from "src/lang/locale/zh-cn"; +import zh_tw from "src/lang/locale/zh-tw"; export const localeMap: { [k: string]: Partial } = { - en, - ru + ru, + ar, + bn, + cz, + da, + de, + en_gb, + es, + fr, + hi, + id, + it, + ja, + ko, + mr, + nl, + no, + pl, + pt_br, + pt, + ro, + sw, + ta, + te, + th, + tr, + uk, + ur, + vi, + zh_cn, + zh_tw }; const locale = localeMap[moment.locale()]; diff --git a/src/lang/locale/ar.ts b/src/lang/locale/ar.ts new file mode 100644 index 0000000..32ace9f --- /dev/null +++ b/src/lang/locale/ar.ts @@ -0,0 +1,3 @@ +// Arabic +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/bn.ts b/src/lang/locale/bn.ts new file mode 100644 index 0000000..b0e6c27 --- /dev/null +++ b/src/lang/locale/bn.ts @@ -0,0 +1,2 @@ +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/cz.ts b/src/lang/locale/cz.ts new file mode 100644 index 0000000..b0e6c27 --- /dev/null +++ b/src/lang/locale/cz.ts @@ -0,0 +1,2 @@ +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/da.ts b/src/lang/locale/da.ts new file mode 100644 index 0000000..d6798fa --- /dev/null +++ b/src/lang/locale/da.ts @@ -0,0 +1,3 @@ +// Danish +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/de.ts b/src/lang/locale/de.ts new file mode 100644 index 0000000..b0e6c27 --- /dev/null +++ b/src/lang/locale/de.ts @@ -0,0 +1,2 @@ +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/en-gb.ts b/src/lang/locale/en-gb.ts new file mode 100644 index 0000000..c3621ca --- /dev/null +++ b/src/lang/locale/en-gb.ts @@ -0,0 +1,3 @@ +// English (British) +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/es.ts b/src/lang/locale/es.ts new file mode 100644 index 0000000..572b4e7 --- /dev/null +++ b/src/lang/locale/es.ts @@ -0,0 +1,3 @@ +// Spanish +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/fr.ts b/src/lang/locale/fr.ts new file mode 100644 index 0000000..b0e6c27 --- /dev/null +++ b/src/lang/locale/fr.ts @@ -0,0 +1,2 @@ +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/hi.ts b/src/lang/locale/hi.ts new file mode 100644 index 0000000..b0e6c27 --- /dev/null +++ b/src/lang/locale/hi.ts @@ -0,0 +1,2 @@ +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/id.ts b/src/lang/locale/id.ts new file mode 100644 index 0000000..32f108f --- /dev/null +++ b/src/lang/locale/id.ts @@ -0,0 +1,3 @@ +// Indonesian +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/it.ts b/src/lang/locale/it.ts new file mode 100644 index 0000000..a2d9ea9 --- /dev/null +++ b/src/lang/locale/it.ts @@ -0,0 +1,3 @@ +// Italian +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/ja.ts b/src/lang/locale/ja.ts new file mode 100644 index 0000000..1e65c69 --- /dev/null +++ b/src/lang/locale/ja.ts @@ -0,0 +1,3 @@ +// Japanese +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/ko.ts b/src/lang/locale/ko.ts new file mode 100644 index 0000000..e2a6bb7 --- /dev/null +++ b/src/lang/locale/ko.ts @@ -0,0 +1,3 @@ +// Korean +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/mr.ts b/src/lang/locale/mr.ts new file mode 100644 index 0000000..b0e6c27 --- /dev/null +++ b/src/lang/locale/mr.ts @@ -0,0 +1,2 @@ +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/nl.ts b/src/lang/locale/nl.ts new file mode 100644 index 0000000..b0e6c27 --- /dev/null +++ b/src/lang/locale/nl.ts @@ -0,0 +1,2 @@ +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/no.ts b/src/lang/locale/no.ts new file mode 100644 index 0000000..8c8dd16 --- /dev/null +++ b/src/lang/locale/no.ts @@ -0,0 +1,3 @@ +// Norwegian +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/pl.ts b/src/lang/locale/pl.ts new file mode 100644 index 0000000..b0e6c27 --- /dev/null +++ b/src/lang/locale/pl.ts @@ -0,0 +1,2 @@ +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/pt-br.ts b/src/lang/locale/pt-br.ts new file mode 100644 index 0000000..85af589 --- /dev/null +++ b/src/lang/locale/pt-br.ts @@ -0,0 +1,3 @@ +// Portuguese (Brazil) +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/pt.ts b/src/lang/locale/pt.ts new file mode 100644 index 0000000..b0e6c27 --- /dev/null +++ b/src/lang/locale/pt.ts @@ -0,0 +1,2 @@ +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/ro.ts b/src/lang/locale/ro.ts new file mode 100644 index 0000000..51315c1 --- /dev/null +++ b/src/lang/locale/ro.ts @@ -0,0 +1,3 @@ +// Romanian +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/sw.ts b/src/lang/locale/sw.ts new file mode 100644 index 0000000..c1ef82b --- /dev/null +++ b/src/lang/locale/sw.ts @@ -0,0 +1,3 @@ +// Swahili +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/ta.ts b/src/lang/locale/ta.ts new file mode 100644 index 0000000..6ee44e9 --- /dev/null +++ b/src/lang/locale/ta.ts @@ -0,0 +1,3 @@ +// Tamil +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/te.ts b/src/lang/locale/te.ts new file mode 100644 index 0000000..118b548 --- /dev/null +++ b/src/lang/locale/te.ts @@ -0,0 +1,3 @@ +// Telugu +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/th.ts b/src/lang/locale/th.ts new file mode 100644 index 0000000..b0e6c27 --- /dev/null +++ b/src/lang/locale/th.ts @@ -0,0 +1,2 @@ +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/tr.ts b/src/lang/locale/tr.ts new file mode 100644 index 0000000..e717aeb --- /dev/null +++ b/src/lang/locale/tr.ts @@ -0,0 +1,3 @@ +// Turkish +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/uk.ts b/src/lang/locale/uk.ts new file mode 100644 index 0000000..8b37e3f --- /dev/null +++ b/src/lang/locale/uk.ts @@ -0,0 +1,3 @@ +// Ukrainian +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/ur.ts b/src/lang/locale/ur.ts new file mode 100644 index 0000000..a344a04 --- /dev/null +++ b/src/lang/locale/ur.ts @@ -0,0 +1,3 @@ +// Urdu +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/vi.ts b/src/lang/locale/vi.ts new file mode 100644 index 0000000..8a0f680 --- /dev/null +++ b/src/lang/locale/vi.ts @@ -0,0 +1,3 @@ +// Vietnamese +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/zh-cn.ts b/src/lang/locale/zh-cn.ts new file mode 100644 index 0000000..62bf18f --- /dev/null +++ b/src/lang/locale/zh-cn.ts @@ -0,0 +1,3 @@ +// Chinese (Simplified) +export default { +}; \ No newline at end of file diff --git a/src/lang/locale/zh-tw.ts b/src/lang/locale/zh-tw.ts new file mode 100644 index 0000000..82f361d --- /dev/null +++ b/src/lang/locale/zh-tw.ts @@ -0,0 +1,3 @@ +// Chinese (Traditional) +export default { +}; \ No newline at end of file diff --git a/src/styles.scss b/src/styles.scss index a178c67..15dbcc8 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -1,4 +1,2 @@ -@use '../node_modules/lichess-pgn-viewer/scss/lichess-pgn-viewer' as *; - -/* Здесь вы можете добавить свои собственные стили или переопределения, если это необходимо */ +@import '../node_modules/lichess-pgn-viewer/scss/lichess-pgn-viewer.scss';