Skip to content

Commit

Permalink
Merge branch 'SAWARATSUKI:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
xelab04 authored Apr 27, 2024
2 parents ef70b2e + 5ffce64 commit 9ecefec
Show file tree
Hide file tree
Showing 25 changed files with 783 additions and 212 deletions.
5 changes: 3 additions & 2 deletions .github/ISSUE_TEMPLATE/fix-request-ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ body:
value: |
issuesに投稿してください。確認次第作成します。
個人のスケジュールにより対応できない場合もあります。数日かかる場合もあります。
ロゴは誤字脱字等の誤り修正のみ対応します。ロゴのデザイン変更は対応しません。
- type: checkboxes
id: duplicate-check
Expand All @@ -28,7 +29,7 @@ body:
placeholder: 例) GitHub
validations:
required: true

- type: input
id: revision-detail
attributes:
Expand All @@ -37,7 +38,7 @@ body:
placeholder: 例) Githubの日本語表記を「ぎっとはぶ」から「ギットハブ」に修正
validations:
required: true

- type: textarea
id: comment
attributes:
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/fix-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ body:
value: |
Please post it in the issues. We'll create it once confirmed.
Depending on individual schedules, we may not be able to respond immediately. It may take several days.
Logo will be handled only for correction of typographical errors and other mistakes. Logo design changes will not be handled.
- type: checkboxes
id: duplicate-check
Expand Down
9 changes: 9 additions & 0 deletions .github/ISSUE_TEMPLATE/request-ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ body:
validations:
required: true

- type: input
id: service-name-ja
attributes:
label: サービス名の日本語での読み方
description: 追加を希望するサービスの日本語での読み方
placeholder: 例) ギットハブ
validations:
required: true

- type: textarea
id: comment
attributes:
Expand Down
9 changes: 9 additions & 0 deletions .github/ISSUE_TEMPLATE/request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ body:
validations:
required: true

- type: input
id: service-name-ja
attributes:
label: Service name in Japanese
description: How to read the service you wish to add in Japanese.
placeholder: 例) ギットハブ
validations:
required: true

- type: textarea
id: comment
attributes:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
# Pull Request

## Description

[Please include a brief description of the changes or features you are proposing.]

## Related Issues

[If this pull request is related to any GitHub issue(s), please reference them here.]

## Pictures (if applicable)

[Include any pictures that help demonstrate the changes.]

## Checklist
- [ ] I have added/updated tests to cover my changes.
- [ ] All new and existing tests passed.

- [ ] I have tested the changes/updates before submitting this pull request.

## Additional Notes

[Add any additional notes or context about the changes here.]
48 changes: 48 additions & 0 deletions .github/workflows/update-readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Update Image List

permissions: write-all

on:
push:
paths:
- "**.png"
- "docs/README*"
- "docs/scripts/**"
workflow_dispatch:

jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: true

- uses: pnpm/action-setup@v3
with:
version: latest
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- uses: pdm-project/setup-pdm@v3

- name: Run Job
run: |-
# pdm install # no 3rd lib used
pdm run generate
pnpm i
pnpm format
if [[ -n "$(git status -s)" ]]; then
git add .
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
git commit -m "Update Image List"
git push
else
echo "No changes detected."
fi
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
.venv
.pdm-python
1 change: 1 addition & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
singleQuote: false
Binary file added 404Notfound/NotFound.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Discord/Discord.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified GitHub/GitHub.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Hono/Hono.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MS-DOS/MS-DOS.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
152 changes: 85 additions & 67 deletions docs/README-ja.md

Large diffs are not rendered by default.

155 changes: 87 additions & 68 deletions docs/README-zhHans.md

Large diffs are not rendered by default.

97 changes: 90 additions & 7 deletions docs/README-zhHant.md

Large diffs are not rendered by default.

152 changes: 86 additions & 66 deletions docs/README.md

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions docs/ReplaceGuide/Rider/Rider-en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Replace Rider Startup Image

---

## Version 2024.1

---

- Open the `%userprofile%\AppData\Local\Programs\Rider\lib` folder
- Copy `app.jar` to an empty folder and make sure to back it up
- Create a new folder in this directory and move `app.jar` into it
- Go into this folder, right-click, choose `Open in Terminal`, and enter `jar -xvf app.jar` to extract. After extraction, delete `app.jar`
- Then go to the `rider\artwork\release` directory within this folder
- Rename the downloaded images to `splash.png` and `[email protected]` to replace the original images
- Return to the extracted folder, then run `jar -cfM0 ../app.jar ./` to compress the current folder, and save it to the parent directory
- Put the new `app.jar` into `%userprofile%\AppData\Local\Programs\Rider\lib` to replace the original
- Finally, delete all files in `%userprofile%\AppData\Local\JetBrains\Rider2024.1\splash`
17 changes: 17 additions & 0 deletions docs/ReplaceGuide/Rider/Rider-jp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Rider のスタートアップ画像の交換

---

## 2024.1 バージョン

---

- `%userprofile%\AppData\Local\Programs\Rider\lib` フォルダを開く
- `app.jar` を空のフォルダにコピーし、バックアップを取る
- 同じディレクトリに新しいフォルダを作成し、`app.jar` を移動する
- このフォルダに入り、右クリックして「ターミナルで開く」を選択し、`jar -xvf app.jar` と入力して解凍する。解凍後、`app.jar` を削除する
- このフォルダ内の `rider\artwork\release` ディレクトリに移動
- ダウンロードした画像を `splash.png``[email protected]` にリネームして、元の画像を置き換える
- 解凍されたフォルダに戻り、`jar -cfM0 ../app.jar ./` を実行して、現在のフォルダを圧縮し、上のディレクトリに保存する
- 新しい `app.jar``%userprofile%\AppData\Local\Programs\Rider\lib` に配置して、元のファイルと交換する
- 最後に、`%userprofile%\AppData\Local\JetBrains\Rider2024.1\splash` のすべてのファイルを削除する
17 changes: 17 additions & 0 deletions docs/ReplaceGuide/Rider/Rider-zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 替换 Rider 启动图片

---

## 2024.1 版本

---

- 打开 `%userprofile%\AppData\Local\Programs\Rider\lib` 文件夹
-`app.jar` 复制到一个空的文件夹,并注意备份该文件
- 在此目录下再创建一个新的文件夹,并将 `app.jar` 移动进去
- 进入此文件夹,右键选择 `在终端中打开` ,输入 `jar -xvf app.jar` 解压,解压完后删除 `app.jar`
- 然后进入此文件夹中的 `rider\artwork\release` 目录
- 将下载好的图片重命名为 `splash.png``[email protected]` 替换原来的图片
- 回到解压后的目录,通过终端执行 `jar -cfM0 ../app.jar ./` 来压缩当前目录,并将结果保存到上层目录
- 将新的 `app.jar` 放到 `%userprofile%\AppData\Local\Programs\Rider\lib` 进行替换
- 最后将 `%userprofile%\AppData\Local\JetBrains\Rider2024.1\splash` 内的文件全部删除
122 changes: 122 additions & 0 deletions docs/scripts/generate-images-table.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
import re
from contextlib import suppress
from dataclasses import dataclass
from pathlib import Path
from typing import TypeAlias
from urllib.parse import quote

FolderDict: TypeAlias = dict[str, list[Path]]


@dataclass
class ReadMeInfo:
path: Path
locale: str


DOCS_FOLDER = Path(__file__).parent.parent
ROOT_FOLDER = DOCS_FOLDER.parent

START = "<!-- image-list: start -->"
END = "<!-- image-list: end -->"


LOCALE: dict[str, dict[str, str]] = {
"en": {"name": "Name", "image": "Image"},
"ja": {"name": "名前", "image": "画像"},
"zhHans": {"name": "名称", "image": "图片"},
"zhHant": {"name": "名稱", "image": "圖片"},
}


def l5(n: str | None, k: str) -> str:
if n:
with suppress(KeyError):
return LOCALE[n][k]
with suppress(KeyError):
return LOCALE["en"][k]
return k


def find_image_folders() -> FolderDict:
return {
x.name: images
for x in ROOT_FOLDER.iterdir()
if x.is_dir() and (images := list(x.glob("*.png")))
}


def find_readme() -> list[ReadMeInfo]:
return [
ReadMeInfo(
path=x,
locale=(
res["loc"]
if (res := re.search(r"README-(?P<loc>.+)", x.stem))
else "en"
),
)
for x in DOCS_FOLDER.glob("README*.md")
]


def generate_markdown(folders: FolderDict, locale: str | None = None) -> str:
def get_image_tags(images: list[Path]) -> str:
return " ".join(
(
f'<img src="../{quote(x.relative_to(ROOT_FOLDER).as_posix())}" '
f'alt="{quote(x.stem)}" width="100" />'
)
for x in images
)

item_list = [
(
folder,
sorted( # move exact match to first
images,
key=lambda x: "\0" if x.stem == folder else x.stem.lower(),
),
)
for folder, images in sorted(folders.items(), key=lambda x: x[0].lower())
]
lines = [
f"| {l5(locale, 'name')} | {l5(locale, 'image')} |",
"| --- | --- |",
*(f"| {folder} | {get_image_tags(images)} |" for folder, images in item_list),
]
return "\n".join(lines)


def replace_file(content: str, inner: str) -> str:
start_index = content.find(START)
end_index = content.find(END)
if start_index == -1 or end_index == -1 or start_index >= end_index:
raise ValueError("Invalid table start or end mark")

pfx = content[: content.index(START) + len(START)]
sfx = content[content.index(END) :]
return f"{pfx}\n\n{inner}\n\n{sfx}"


def process_file(info: ReadMeInfo, image_folders: FolderDict):
md_table = generate_markdown(image_folders, info.locale)
content = info.path.read_text("u8")
try:
replaced = replace_file(content, md_table)
except ValueError as e:
raise ValueError(f"Error replacing {info.path.name}") from e
info.path.write_text(replaced, "u8")


def main():
image_folders = find_image_folders()
print(f"Found {len(image_folders)} image folders")
readme_files = find_readme()
for info in readme_files:
print(f"Processing {info.path.name}, locale: {info.locale}")
process_file(info, image_folders)


if __name__ == "__main__":
main()
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"private": true,
"scripts": {
"format": "prettier -cw ."
},
"devDependencies": {
"prettier": "^3.2.5"
}
}
64 changes: 64 additions & 0 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9ecefec

Please sign in to comment.