[GH-ISSUE #1746] CN language strings 界面设置为中文的解决办法 #1480

Open
opened 2026-02-28 01:30:14 +03:00 by kerem · 6 comments
Owner

Originally created by @RorinL on GitHub (Jun 28, 2024).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1746

前往我的站点

WiFiManager.h AP配网在使用的时候需要改为显示中文,开始以为是使用 setCountry("CN") 来设置,但是怎么改都没变化,看了WiFiManager.cpp 和 WiFiManager.h 才知道原来这个函数作用是设置 WiFi AP 模块的国家代码,国家代码决定了模块可以使用的无线信道和频率范围(不同的国家和地区有不同的无线电频谱规定); 例如,在美国(国家代码为 "US"),WiFi 信道通常从 1 到 11,而在欧洲,信道可以从 1 到 13;也就是说setCountry函数是用于确保 WiFi 模块遵循当地的无线电频谱规定

个人感觉没什么用吧,哈哈;rorinliang076 at/ gmail不过我也设置了"CN".

本人开发环境

arduino ide2.3.2
WiFiManager版本2.0.17
windows 10专业版

汉化方法

  1. 先下载文件 WiFiManager汉化文件, 解压后得到 wm_consts_cn.h以及wm_strings_cn.h,strings_cn.h;将三个文件放到WiFiManager根目录下;
    WiFiManager一般安装在Arduino工具->首选项->项目文件夹地址下的 libraries 文件夹中fongdan,com
  2. 打开 WiFiManager.h,修改 WM_STRINGS_FILE,将 wm_strings_en.h 修改为 wm_strings_cn.h
// Include wm strings vars fongdan,com
// Pass in strings env override via WM_STRINGS_FILE
#ifndef WM_STRINGS_FILE
#define WM_STRINGS_FILE "wm_strings_en.h" // 修改为 wm_strings_cn.h
#endif
#include WM_STRINGS_FILE

这样就可以完成汉化了

其他

或者会疑问,为什么我在我的代码文件不直接像下面这样?这样不就能改了吗,又不会修改源文件.

#define WM_STRINGS_FILE "wm_strings_cn.h"
#include <WiFiManager.h>

但是修改不了,我也不知道为什么
fongdan.com

如果你觉得我的解决办法好,同时你想将其添加到该开源项目,那么感谢你!同时请你能注明来源

前往我的站点

Originally created by @RorinL on GitHub (Jun 28, 2024). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1746 [前往我的站点](https://fongdan.com/article/detail/19) WiFiManager.h AP配网在使用的时候需要改为显示中文,开始以为是使用 setCountry("CN") 来设置,但是怎么改都没变化,看了WiFiManager.cpp 和 WiFiManager.h 才知道原来这个函数作用是设置 WiFi AP 模块的国家代码,国家代码决定了模块可以使用的无线信道和频率范围(不同的国家和地区有不同的无线电频谱规定); 例如,在美国(国家代码为 "US"),WiFi 信道通常从 1 到 11,而在欧洲,信道可以从 1 到 13;也就是说setCountry函数是用于确保 WiFi 模块遵循当地的无线电频谱规定 个人感觉没什么用吧,哈哈;rorinliang076 at/ gmail不过我也设置了"CN". ### 本人开发环境 arduino ide2.3.2 [WiFiManager版本2.0.17](https://github.com/tzapu/WiFiManager) windows 10专业版 ### 汉化方法 1. 先下载文件 [WiFiManager汉化文件](https://www.lanzoub.com/itPSy22ycqkh ), 解压后得到 wm_consts_cn.h以及wm_strings_cn.h,strings_cn.h;将三个文件放到WiFiManager根目录下; WiFiManager一般安装在Arduino工具->首选项->项目文件夹地址下的 libraries 文件夹中fongdan,com 2. 打开 WiFiManager.h,修改 WM_STRINGS_FILE,将 wm_strings_en.h 修改为 wm_strings_cn.h ``` // Include wm strings vars fongdan,com // Pass in strings env override via WM_STRINGS_FILE #ifndef WM_STRINGS_FILE #define WM_STRINGS_FILE "wm_strings_en.h" // 修改为 wm_strings_cn.h #endif #include WM_STRINGS_FILE ``` 这样就可以完成汉化了 ### 其他 或者会疑问,为什么我在我的代码文件不直接像下面这样?这样不就能改了吗,又不会修改源文件. ``` #define WM_STRINGS_FILE "wm_strings_cn.h" #include <WiFiManager.h> ``` 但是修改不了,我也不知道为什么 fongdan.com 如果你觉得我的解决办法好,同时你想将其添加到该开源项目,那么感谢你!同时请你能注明来源 [前往我的站点](https://fongdan.com/article/detail/19)
Author
Owner

@tablatronix commented on GitHub (Jun 28, 2024):

Can you pull request this ?

#define WM_STRINGS_FILE "wm_strings_cn.h" only works when defined in build enviroment, wont work from .ino sketch

<!-- gh-comment-id:2196914097 --> @tablatronix commented on GitHub (Jun 28, 2024): Can you pull request this ? `#define WM_STRINGS_FILE "wm_strings_cn.h"` only works when defined in build enviroment, wont work from .ino sketch
Author
Owner

@RorinL commented on GitHub (Jun 28, 2024):

I'm not really good with this pull request, so maybe I'll just leave it here😂.Thank you for your answer

---原始邮件---
发件人: "Shawn @.>
发送时间: 2024年6月28日(周五) 晚上9:32
收件人: @.
>;
抄送: @.@.>;
主题: Re: [tzapu/WiFiManager] 界面设置为中文的解决办法 (Issue #1746)

Can you pull request this ?

#define WM_STRINGS_FILE "wm_strings_cn.h" only works when defined in build enviroment, wont work from .ino sketch


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: @.***>

<!-- gh-comment-id:2196967455 --> @RorinL commented on GitHub (Jun 28, 2024): I'm not really good with this pull request, so maybe I'll just leave it here😂.Thank you for your answer ---原始邮件--- 发件人: "Shawn ***@***.***&gt; 发送时间: 2024年6月28日(周五) 晚上9:32 收件人: ***@***.***&gt;; 抄送: ***@***.******@***.***&gt;; 主题: Re: [tzapu/WiFiManager] 界面设置为中文的解决办法 (Issue #1746) Can you pull request this ? #define WM_STRINGS_FILE "wm_strings_cn.h" only works when defined in build enviroment, wont work from .ino sketch — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: ***@***.***&gt;
Author
Owner

@wzsx150 commented on GitHub (Sep 16, 2024):

我已经提交了中文翻译的PR,欢迎大家一起优化中文翻译。
I have submitted a PR for the Chinese translation, and I welcome everyone to help optimize the Chinese translation.
https://github.com/tzapu/WiFiManager/pull/1764

<!-- gh-comment-id:2353624052 --> @wzsx150 commented on GitHub (Sep 16, 2024): 我已经提交了中文翻译的PR,欢迎大家一起优化中文翻译。 I have submitted a PR for the Chinese translation, and I welcome everyone to help optimize the Chinese translation. https://github.com/tzapu/WiFiManager/pull/1764
Author
Owner

@YourMao commented on GitHub (Sep 26, 2024):

可用

<!-- gh-comment-id:2376311552 --> @YourMao commented on GitHub (Sep 26, 2024): 可用
Author
Owner

@444136347 commented on GitHub (Oct 1, 2024):

@RorinL 在页面上,会有点问题。
(1)点击选择对应WiFi,无法自动填入WiFi名称
(2)show Passpwd有点问题

<!-- gh-comment-id:2385778743 --> @444136347 commented on GitHub (Oct 1, 2024): @RorinL 在页面上,会有点问题。 (1)点击选择对应WiFi,无法自动填入WiFi名称 (2)show Passpwd有点问题
Author
Owner

@zofui commented on GitHub (Mar 24, 2025):

@RorinL 在页面上,会有点问题。 (1)点击选择对应WiFi,无法自动填入WiFi名称 (2)show Passpwd有点问题

他里面的onlick的字符o输入错了,你删除他的改成使用英文onclick就好了

<!-- gh-comment-id:2746722354 --> @zofui commented on GitHub (Mar 24, 2025): > [@RorinL](https://github.com/RorinL) 在页面上,会有点问题。 (1)点击选择对应WiFi,无法自动填入WiFi名称 (2)show Passpwd有点问题 他里面的onlick的字符o输入错了,你删除他的改成使用英文onclick就好了
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#1480
No description provided.