Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
ZZHow1024 committed Sep 9, 2024
2 parents ee40770 + 18b84cc commit 2a9987a
Show file tree
Hide file tree
Showing 3 changed files with 155 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,26 @@ https://github.com/ZZHow1024/MagicEncoding/releases

---

## **Instructions for use**

- Determine the operating system you are using.
- Linux:
- Select .deb installation package/ .rpm installation package.
- macOS:
- Determine the chipset of your Mac (Apple Silicon / Intel).
- Select .dmg disk image/ .pkg installation package.
- Windows:
- Select .zip package/.exe installation package/.msi installation package.
- Download the corresponding file.
- Linux and macOS users need to perform the installation operation before running. Windows users can directly run the .exe executable program in the .zip compressed package or select the .exe installation package and .msi installation package to perform the installation operation.
- Start MagicEncoding.
- You can select the language in the lower right corner of MagicEncoding's main interface.
- Currently supports Chinese (Simplified / Traditional) and English.
- Drag the folder or file to obtain the path, enter the suffix name to be filtered (separate multiple suffix names with "&"), and click Find File.
- Select the original encoding and target encoding, and click "Start Conversion".

---

## 功能介绍

- MagicEncoding2.0.0
Expand Down
78 changes: 78 additions & 0 deletions README_ZH.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# [JavaFX 项目]神奇编码_**MagicEncoding**(中文说明)

[**English**](README.md)

---

Website:

[[JavaFX 项目]神奇编码_MagicEncoding | ZZHow](https://www.zzhow.com/MagicEncoding)

Source Code:

https://github.com/ZZHow1024/MagicEncoding

Releases:

https://github.com/ZZHow1024/MagicEncoding/releases

---

## License

This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.

---

## 使用说明

- 确定您使用的操作系统。
- Linux:
- 选择 .deb安装包 / .rpm安装包。
- macOS:
- 确定您使用的 Mac 的芯片(Apple Silicon / Intel)。
- 选择 .dmg磁盘镜像 / .pkg安装包。
- Windows:
- 选择 .zip压缩包 / .exe安装包 / .msi安装包。
- 下载对应的文件。
- Linux 和 macOS 需要执行安装操作后再运行,Windows 可直接运行 .zip 压缩包中的 .exe 可执行程序或选择 .exe 安装包与 .msi 安装包执行安装操作。
- 启动 MagicEncoding。
- 在 MagicEncoding 的主界面右下方可以选择语言。
- 当前支持中文(简体 / 繁体)与英文。
- 拖拽文件夹或文件获取路径,填入需要筛选的后缀名(多种后缀名用“&”分隔),单击“查找文件”。
- 选择原始编码与目标编码,单击“开始转换”。

---

## 功能介绍

- MagicEncoding3.0.0
- 自动识别编码。
- 单文件转换。
- 支持多语言。
- 中文(简体/繁体)
- 英文
- MagicEncoding2.0.0
- 拖拽文件夹获取路径。
- 查找多种后缀名。
- 支持覆盖原文件。
- MagicEncoding1.0.0
- "GBK" 与 "UTF-8" 之间的编码转换。
- 根据路径查找文件。
- 支持根据文件后缀名筛选文件。

---

## **效果图**

![MagicEncoding3.0.0_ZH](https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F4b165318-6383-451c-8845-110b786c9f0a%2F59e24efe-e112-48a3-8ca6-fa721270fca0%2FMagicEncoding3.0.0_ZH.png?table=block&id=63c5eb8e-9288-4418-a76b-627ee422a9c5&t=63c5eb8e-9288-4418-a76b-627ee422a9c5&width=1624&cache=v2)

MagicEncoding3.0.0_ZH

![MagicEncoding2.0.0](https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F4b165318-6383-451c-8845-110b786c9f0a%2Fcea3d468-2198-4819-a5c3-cb4f3f287dfa%2FMagicEncoding2.0.0.png?table=block&id=34817b71-f9d4-42b9-91e9-a477ad85b262&t=34817b71-f9d4-42b9-91e9-a477ad85b262&width=1624&cache=v2)

MagicEncoding2.0.0

![MagicEncoding1.0.0](https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F4b165318-6383-451c-8845-110b786c9f0a%2F94657332-79a5-4e54-b697-8979784a6da3%2FMagicEncoding1.0.0.png?table=block&id=c8dd391f-0e31-455c-8dc3-2b154b44605f&t=c8dd391f-0e31-455c-8dc3-2b154b44605f&width=1624&cache=v2)

MagicEncoding1.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

import java.io.File;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.SortedMap;

public class MainController {

Expand Down Expand Up @@ -43,6 +46,32 @@ private void initialize() {
originChoiceBox.setValue("GBK");
targetChoiceBox.getItems().addAll("UTF-8", "GBK");
targetChoiceBox.setValue("UTF-8");
languageSelector.getItems().addAll("简体中文", "繁體中文", "English");

String language = Locale.getDefault().toLanguageTag();

if (language.contains("zh")) {
if (language.contains("Hans"))
language = "zh_CN";
else if (language.contains("Hant"))
language = "zh_TW";
else if (language.contains("CN"))
language = "zh_CN";
else
language = "zh_TW";
} else {
language = "en_US";
}

language = switch (language) {
case "zh_CN" -> "简体中文";
case "zh_TW" -> "繁體中文";
case "en_US" -> "English";
default -> "简体中文";
};
languageSelector.setValue(language);
Application.language = language;
switchLanguage();
}

@FXML
Expand Down Expand Up @@ -100,4 +129,32 @@ private void onAbout() {
About.open();
}

@FXML
private void switchLanguage() {
String selectorValue = languageSelector.getValue();
selectorValue = switch (selectorValue) {
case "简体中文" -> "zh_CN";
case "繁體中文" -> "zh_TW";
case "English" -> "en_US";
default -> "zh_Hans";
};

Application.setLanguage(selectorValue);

ResourceBundle bundle = Application.bundle;

// 更新界面上的文本
Label1.setText(bundle.getString("Label1"));
Label2.setText(bundle.getString("Label2"));
Label3.setText(bundle.getString("Label3"));
Label4.setText(bundle.getString("Label4"));
Label5.setText(bundle.getString("Label5"));
Label6.setText(bundle.getString("Label6"));
Label7.setText(bundle.getString("Label7") + fileService.getTargetFileList().size());
Button1.setText(bundle.getString("Button1"));
Button2.setText(bundle.getString("Button2"));
Button3.setText(bundle.getString("Button3"));
Button4.setText(bundle.getString("Button4"));
isOverwriteCheckBox.setText(bundle.getString("isOverwriteCheckBox"));
}
}

0 comments on commit 2a9987a

Please sign in to comment.