获取其他频道的本地化名称
Get localized name other channel
我从 applications.ini.
得到 firefox 的版本号
然后我硬编码了日期#### 和#### v35 之间的版本。所以现在基于这个和 applications.ini 的当前日期和版本我找出其他版本的频道。
但现在我想获取频道的本地化名称。
例如,我正在使用测试版频道,我想从这个版本中获取 "Nightly" 的中文本地化名称,因此它具有中文字符,并且在中文中表示夜间。这也可以从applications.ini
中得到吗? [App] -> Name
是否本地化于 applications.ini?
这是 applications.ini 方法:https://ask.mozilla.org/question/705/detect-if-auroranightlybetanormal-and-get-paths/(感谢@paa)
编辑
我发现了这个文件:OS.Path.join(Services.dirsvc.get('XREExeF', Ci.nsIFile).parent.path, 'defaults', 'pref', 'channel-prefs.js')
其内容如下:
//@line 2 "c:\builds\moz2_slave\rel-m-beta-w32_bld-00000000000\build\browser\app\profile\channel-prefs.js"
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
pref("app.update.channel", "beta");
这个检查靠谱吗?此 channel-prefs.js
文件是否在所有版本安装后立即存在?
Is this a reliable check?
不是真的。曾经有频道切换器插件,理论上用户可以更改此首选项(尽管目前我认为这还不足以真正切换频道)。
Does this channel-prefs.js file exist for all builds as soon as they are installed?
是的,暂时。但这是一个实现细节。不能保证该文件以后不会被移动或重命名,或与另一个文件合并。
Can this also be obtained from the applications.ini?
本地化名称?我什至不知道有一个......我以为它被称为例如"Nightly" 在所有语言环境中都像是(产品)名称。但是,是的,理论上可以本地化该字符串。不过,它在 ini 文件中不可用。
无论如何我不会戳application.ini,而只是使用Services.appinfo.defaultUpdateChannel
But now I want to get the localized name of the channel.
由于您已经在 运行 Firefox 实例中(根据您的 OS.File
代码判断),您应该使用字符串捆绑服务来加载 chrome://branding/locale/brand.properties
并获取 brandShortName
或 brandFullName
字符串。
我从 applications.ini.
得到 firefox 的版本号然后我硬编码了日期#### 和#### v35 之间的版本。所以现在基于这个和 applications.ini 的当前日期和版本我找出其他版本的频道。
但现在我想获取频道的本地化名称。
例如,我正在使用测试版频道,我想从这个版本中获取 "Nightly" 的中文本地化名称,因此它具有中文字符,并且在中文中表示夜间。这也可以从applications.ini
中得到吗? [App] -> Name
是否本地化于 applications.ini?
这是 applications.ini 方法:https://ask.mozilla.org/question/705/detect-if-auroranightlybetanormal-and-get-paths/(感谢@paa)
编辑
我发现了这个文件:OS.Path.join(Services.dirsvc.get('XREExeF', Ci.nsIFile).parent.path, 'defaults', 'pref', 'channel-prefs.js')
其内容如下:
//@line 2 "c:\builds\moz2_slave\rel-m-beta-w32_bld-00000000000\build\browser\app\profile\channel-prefs.js"
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
pref("app.update.channel", "beta");
这个检查靠谱吗?此 channel-prefs.js
文件是否在所有版本安装后立即存在?
Is this a reliable check?
不是真的。曾经有频道切换器插件,理论上用户可以更改此首选项(尽管目前我认为这还不足以真正切换频道)。
Does this channel-prefs.js file exist for all builds as soon as they are installed?
是的,暂时。但这是一个实现细节。不能保证该文件以后不会被移动或重命名,或与另一个文件合并。
Can this also be obtained from the applications.ini?
本地化名称?我什至不知道有一个......我以为它被称为例如"Nightly" 在所有语言环境中都像是(产品)名称。但是,是的,理论上可以本地化该字符串。不过,它在 ini 文件中不可用。
无论如何我不会戳application.ini,而只是使用Services.appinfo.defaultUpdateChannel
But now I want to get the localized name of the channel.
由于您已经在 运行 Firefox 实例中(根据您的 OS.File
代码判断),您应该使用字符串捆绑服务来加载 chrome://branding/locale/brand.properties
并获取 brandShortName
或 brandFullName
字符串。