creating future localizations, and adding readme

This commit is contained in:
Riffaells 2024-12-01 13:50:40 +05:00
parent 6c9ef391e3
commit 1b8c90e2be
34 changed files with 219 additions and 87 deletions

111
README.md
View File

@ -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

48
README_RU.md Normal file
View File

@ -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
```
````

View File

@ -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<typeof en> } = {
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()];

3
src/lang/locale/ar.ts Normal file
View File

@ -0,0 +1,3 @@
// Arabic
export default {
};

2
src/lang/locale/bn.ts Normal file
View File

@ -0,0 +1,2 @@
export default {
};

2
src/lang/locale/cz.ts Normal file
View File

@ -0,0 +1,2 @@
export default {
};

3
src/lang/locale/da.ts Normal file
View File

@ -0,0 +1,3 @@
// Danish
export default {
};

2
src/lang/locale/de.ts Normal file
View File

@ -0,0 +1,2 @@
export default {
};

3
src/lang/locale/en-gb.ts Normal file
View File

@ -0,0 +1,3 @@
// English (British)
export default {
};

3
src/lang/locale/es.ts Normal file
View File

@ -0,0 +1,3 @@
// Spanish
export default {
};

2
src/lang/locale/fr.ts Normal file
View File

@ -0,0 +1,2 @@
export default {
};

2
src/lang/locale/hi.ts Normal file
View File

@ -0,0 +1,2 @@
export default {
};

3
src/lang/locale/id.ts Normal file
View File

@ -0,0 +1,3 @@
// Indonesian
export default {
};

3
src/lang/locale/it.ts Normal file
View File

@ -0,0 +1,3 @@
// Italian
export default {
};

3
src/lang/locale/ja.ts Normal file
View File

@ -0,0 +1,3 @@
// Japanese
export default {
};

3
src/lang/locale/ko.ts Normal file
View File

@ -0,0 +1,3 @@
// Korean
export default {
};

2
src/lang/locale/mr.ts Normal file
View File

@ -0,0 +1,2 @@
export default {
};

2
src/lang/locale/nl.ts Normal file
View File

@ -0,0 +1,2 @@
export default {
};

3
src/lang/locale/no.ts Normal file
View File

@ -0,0 +1,3 @@
// Norwegian
export default {
};

2
src/lang/locale/pl.ts Normal file
View File

@ -0,0 +1,2 @@
export default {
};

3
src/lang/locale/pt-br.ts Normal file
View File

@ -0,0 +1,3 @@
// Portuguese (Brazil)
export default {
};

2
src/lang/locale/pt.ts Normal file
View File

@ -0,0 +1,2 @@
export default {
};

3
src/lang/locale/ro.ts Normal file
View File

@ -0,0 +1,3 @@
// Romanian
export default {
};

3
src/lang/locale/sw.ts Normal file
View File

@ -0,0 +1,3 @@
// Swahili
export default {
};

3
src/lang/locale/ta.ts Normal file
View File

@ -0,0 +1,3 @@
// Tamil
export default {
};

3
src/lang/locale/te.ts Normal file
View File

@ -0,0 +1,3 @@
// Telugu
export default {
};

2
src/lang/locale/th.ts Normal file
View File

@ -0,0 +1,2 @@
export default {
};

3
src/lang/locale/tr.ts Normal file
View File

@ -0,0 +1,3 @@
// Turkish
export default {
};

3
src/lang/locale/uk.ts Normal file
View File

@ -0,0 +1,3 @@
// Ukrainian
export default {
};

3
src/lang/locale/ur.ts Normal file
View File

@ -0,0 +1,3 @@
// Urdu
export default {
};

3
src/lang/locale/vi.ts Normal file
View File

@ -0,0 +1,3 @@
// Vietnamese
export default {
};

3
src/lang/locale/zh-cn.ts Normal file
View File

@ -0,0 +1,3 @@
// Chinese (Simplified)
export default {
};

3
src/lang/locale/zh-tw.ts Normal file
View File

@ -0,0 +1,3 @@
// Chinese (Traditional)
export default {
};

View File

@ -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';