3
macOS自定义本地化文件夹名
source link: https://sobird.me/macos-localized-folder-name.htm
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
默认情况下macOS用户目录下存在以下几个目录:Applications、Desktop、Documents、Downloads、Library、Movies、Music、Pictures、Public。我们发现虽然目录英文的,但在“访达”显示的却是中文目录,那么这是如何做到呢?如果我想将自己创建的英文目录名显示为中文目录,又该如何操作?
本文以 Meituan->美团 为例介绍下本地化文件夹名的方法。
注:虽然网上教程都教你如此操作,但本人在macOS Catalina 10.15 环境下按此操作并未生效成功,故本教程暂不建议大家尝试,如果你尝试成功,或者你知道有哪些坑的话,可以在此文评论留言说明。
添加目录字符串至本地化配置文件
- 打开 Finder,进入
/System/Library/CoreServices/SystemFolderLocalizations/zh_CN.lproj
目录 - 复制文件
SystemFolderLocalizations.strings
到用户目录~/
,在系统10.7之后该文件是二进制格式的,首先要把它转成XML或JSON格式 - 执行
sudo plutil -convert xml1 SystemFolderLocalizations.strings
将该文件转换为XML格式 - 用文本编辑器/vi命令打开该文件,在相应位置添加如下代码:
<key>Meituan</key>
<string>美团</string>
- 执行
sudo plutil -convert binary1 SystemFolderLocalizations.strings
再次将该文件转换为二进制格式 - 将该文件再次拷贝回原来的目录并覆盖掉原来的文件
整个上面的步骤,可以通过下面的命令行一步一步实现:
cd /System/Library/CoreServices/SystemFolderLocalizations/zh_CN.lproj
sudo cp SystemFolderLocalizations.strings ~/
cd ~
sudo plutil -convert xml1 SystemFolderLocalizations.strings
vi SystemFolderLocalizations.strings
# 在文件的合适位置添加下面代码
<key>Meituan</key>
<string>美团</string>
#保存文件
sudo plutil -convert binary1 SystemFolderLocalizations.strings
sudo cp SystemFolderLocalizations.strings /System/Library/CoreServices/SystemFolderLocalizations/zh_CN.lproj
禁用 SIP 保护机制
新版本的macOS如果不禁用掉SIP,是无法更改上面的文件SystemFolderLocalizations.strings
的,为此我们可以暂时的禁用SIP,完成文件后我们再启用SIP即可。
- 重启系统,按住
Command + R
进入恢复模式 - 点击顶部菜单栏
实用工具
中的终端
,输入csrutil disable
命令来禁用SIP
保护机制 - 执行后输出以下信息表示禁用成功:
Successfully disabled System Integrity Protection. Please restart the machine for the changes to take effect.
- 重启系统,进入执行
sudo mount -uw /
打开 SIP 保护机制
基本同上,再终端中输入以下命令 csrutil enable
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK