Skip to content

Commit

Permalink
增加画布笔记和美人鱼图笔记的截图,添加数学公式截图,格式化readme文档
Browse files Browse the repository at this point in the history
  • Loading branch information
Nriver committed Jul 1, 2022
1 parent 88ad5f2 commit 13b6db1
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 50 deletions.
77 changes: 60 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,41 @@
# Trilium Translation

[中文说明](README_CN.md)
This repo provides a translation for the awesome [Trilium Notes](https://github.com/zadam/trilium).
If you'd like to translate Trilium Notes into any language you like, please follow [this guide](https://github.com/Nriver/trilium-translation#how-to-translate).
Currently, I have translated Trilium Notes into Chinese. The translation will keep update to the latest Trilium Notes' stable releases.
If you'd like to translate Trilium Notes into any language you like, please
follow [this guide](https://github.com/Nriver/trilium-translation#how-to-translate).
Currently, I have translated Trilium Notes into Chinese. The translation will keep update to the latest Trilium Notes'
stable releases.

Star this repo if you like it, thx :)

If you have old data, PLEASE BACK UP YOUR DATA BEFORE USE.

<a href="https://count.getloli.com"><img align="center" src="https://count.getloli.com/get/@Nriver_trilium-translation"></a><br>


# Table of Contents

<!--ts-->

* [Table of Contents](#table-of-contents)
* [Trilium Translation](#trilium-translation)
* [Screenshots](#Screenshots)
* [How to use](#how-to-use)
* [How to run server with docker](#how-to-run-server-with-docker)
* [How to translate](#how-to-translate)
* [How does the translation work](#how-does-the-translation-work)
* [Compile Environment Requirement](#compile-environment-requirement)
* [Translate Process](#translate-process)
* [More text to translate](#more-text-to-translate)
* [How does the translation work](#how-does-the-translation-work)
* [Compile Environment Requirement](#compile-environment-requirement)
* [Translate Process](#translate-process)
* [More text to translate](#more-text-to-translate)
* [Limitations](#limitations)
* [Stargazers over time](#stargazers-over-time)
* [Donation](#donation)
* [Thanks](#thanks)

<!--te-->

---

# Screenshots

Original dark theme
Expand All @@ -44,44 +50,67 @@ Nier theme made by me :)

![nier](docs/screenshot_theme_nier.png)

Canvas Note

![am3](docs/excalidraw_demo_am3.gif)

Math formular

![nier](docs/screenshot_math_formular.png)

---

# How to use
1. Download from the latest [Release](https://github.com/Nriver/trilium-translation/releases) that suit your computer system.

1. Download from the latest [Release](https://github.com/Nriver/trilium-translation/releases) that suit your computer
system.
2. Unzip and execute(trilium for Linux, trilium.sh for Linux server, trilium.exe for Windows, trilium.app for macOS).
3. Enjoy :)

# How to run server with docker
For Trilium Notes server, you can download my [docker-compose.yml](https://github.com/Nriver/trilium-translation/blob/main/docker-compose.yml)

For Trilium Notes server, you can download
my [docker-compose.yml](https://github.com/Nriver/trilium-translation/blob/main/docker-compose.yml)
Then run it with docker simply by executing:

```
docker-compose up -d
```

It will download the Chinese version of Trilium I built on [Docker Hub](https://hub.docker.com/repository/docker/nriver/trilium-cn).
It will download the Chinese version of Trilium I built
on [Docker Hub](https://hub.docker.com/repository/docker/nriver/trilium-cn).

Open http://127.0.0.1:8080 in your browser to access the server page.

Your note data will be in the same directory of the docker-compose.yml file.

---

# How to translate
If you would like to check the code (my codes comes with Chinese and English comments, check it) and compile it by yourself. Here is some information may be useful.

If you would like to check the code (my codes comes with Chinese and English comments, check it) and compile it by
yourself. Here is some information may be useful.

WARNING! The scripts I wrote includes some 'rm -rf' commands, modify and use codes with care!

## How does the translation work
It extracts the resource files from the latest Trilium Notes official release and use regular expression to replace UI text for each file. Then pack the translated files back into the package. Done.

It extracts the resource files from the latest Trilium Notes official release and use regular expression to replace UI
text for each file. Then pack the translated files back into the package. Done.

### Compile Environment Requirement
My environment is Manjaro(Linux)/macOS based, but you can make some change to work on other platform. You need to change some path configuration in my code to work on your machine.

My environment is Manjaro(Linux)/macOS based, but you can make some change to work on other platform. You need to change
some path configuration in my code to work on your machine.

Python3 with module

```
pip3 install requests --user
```

Nodejs with module

```
npm install -g asar
npm install -g webpack
Expand All @@ -91,35 +120,47 @@ npm install -g webpack-cli
7z if you want to make release

### Translate Process

1. Modify configurations in `settings.py` by the comments.
2. Do translate in `translations.py`. (See `translations_cn.py`. There are over 1000 lines to translate, be patient :) )
3. Run `python3 init.py` to download latest Trilium Notes.
4. Run `python3 trans.py` to make a translation patch.
4. Run `python3 make_release.py` to apply patch to releases for all platforms.

Note: In `translations.py` there are some texts begin or ends with quotes were made on purpose for regex match, do not remove them in your translation. There are some text like '${xxxx}' in the translation, these are the placeholder in the original Trilium Notes source code, do not modify them unless you know what you are doing.
Note: In `translations.py` there are some texts begin or ends with quotes were made on purpose for regex match, do not
remove them in your translation. There are some text like '${xxxx}' in the translation, these are the placeholder in the
original Trilium Notes source code, do not modify them unless you know what you are doing.

### More text to translate
If you'd like to translate more text, mark each text in the file that you want to translate with double brackets`{{}}` like I did in `trans.py`.

Put everything between double brackets into the dict in `translations.py` and translate to the language you like. (Some text were ended with `}`. Try to avoid triple brackets by change from `${xxx}}}'` to something like `${xxx}'}}` )
If you'd like to translate more text, mark each text in the file that you want to translate with double brackets`{{}}`
like I did in `trans.py`.

Put everything between double brackets into the dict in `translations.py` and translate to the language you like. (Some
text were ended with `}`. Try to avoid triple brackets by change from `${xxx}}}'` to something like `${xxx}'}}` )

---

# Limitations

The translation is hard-coded in the frontend/backend source code, so you can not switch between languages.
If there were some mistakes in the translation, Trilium Notes may not function correctly. Therefore, please back up your data before use.
If there were some mistakes in the translation, Trilium Notes may not function correctly. Therefore, please back up your
data before use.

If you break Trilium Notes somehow, you need to redownload everything with `init.py`.

---

# Stargazers over time

Generated by [caarlos0/starcharts](https://github.com/caarlos0/starcharts).

[![Stargazers over time](https://starchart.cc/Nriver/trilium-translation.svg)](https://starchart.cc/Nriver/trilium-translation)

---

# Donation

If my work helped you, donation is very welcomed, I would be a great inspiration!

Alipay:
Expand All @@ -130,7 +171,9 @@ Wechat Pay:


---

# Thanks

Thank you for your support, it fills me with determination.

Thanks `tr**one` for donating 20.00 CNY!
Expand Down
Loading

0 comments on commit 13b6db1

Please sign in to comment.