ROS命令管理器-实现切换不同语言显示(命令行版)
文章说明:
- 介绍如何使用国际化,目前支持中文,繁体,英文。
- 其他还有8,9种语言,但是还没翻译过来的。
使用步骤
- 首先查看一下本地语言
ubuntu@ROS-EASY-NUC22:~/Desktop$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8
- 查看帮助,默认是英文显示
cs -h
- 效果如下:
+---------------------------------------------------+
| |
| ============================================= |
| |
| Welcome to ROS Commands Manager CLI |
| |
| ============================================= |
| Author:ncnynl |
| Email:1043931@qq.com |
| Website:https://ncnynl.com |
| Date:2022-11-18 |
| QQ Qun B:926779095 |
| QQ Qun C:937347681 |
| QQ Qun D:562093920 |
+---------------------------------------------------+
#####################################################
########commands help to the RCM tools
#####################################################
Usage: cs [options] [keyword]
List of available options:
-h | help: Print this help text.
-s | search: Search the script file by keyword
-si | search-install: Search the script file and install rightnow
-l | list: List all script files and serial numbers
-L | language: Select language with en cn tw cz de es fr hu it jp kr pl br ru
-i | install: Install apt packages
-r | remove: Remove apt packages
-e | edit: Edit script through vim
-c | check: Check script through cat
-b | build: Build install script through template
-u | upgrade: Upgrade RCM
-v | version: Show RCM version
id: Provide the serial number to install
- 切换不同语言, 这里测试用中文显示, 简体中文cn,繁体中文tw,英语en
- 安装中文语言
sudo locale-gen "zh_CN.UTF-8"
- 设置为简体中文语言
cs -L cn
- 执行之后要source bashrc文件
source ~/.bashrc
- 再locale查看是否切换了语言
ubuntu@ROS-EASY-NUC22:~/tools/commands$ locale
LANG=zh_CN.UTF-8
LANGUAGE=
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=zh_CN.UTF-8
- 已经切换了中文,查看帮助
cs -h
- 效果如下
+---------------------------------------------------+
| |
| ============================================= |
| |
| 欢迎使用ROS命令管理器命令行版本 |
| |
| ============================================= |
| 作者:ncnynl |
| 邮箱:1043931@qq.com |
| 网站:https://ncnynl.com |
| 日期:2022-11-18 |
| 创客智造QQ群B:926779095 |
| 创客智造QQ群C:937347681 |
| 创客智造QQ群D:562093920 |
+---------------------------------------------------+
#####################################################
########RCM工具命令行版帮助
#####################################################
用法: cs [options] [keyword]
有效参数列表:
-h | help: 打印帮助文本.
-s | search: 通过关键词搜索脚本
-si | search-install: 通过脚本名搜索并执行脚本
-l | list: 列出所有的脚本及序号
-L | language: Select language with en cn tw cz de es fr hu it jp kr pl br ru
-i | install: 安装APT软件包
-r | remove: 删除APT软件包
-e | edit: 编辑脚本
-c | check: 查看脚本
-b | build: 通过模板生成脚本
-u | upgrade: 升级RCM
-v | version: 显示RCM版本
id: 通过序号执行脚本
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号