[英]Centralize messages in properties file in Extjs
I have multiple Extjs projects, and each of them have common messages (eg the confirmation / warning messages for alert dialog). 我有多个Extjs项目,每个项目都有共同的消息(例如,警报对话框的确认/警告消息)。 I would like to centralize all these messages into a file (eg properties file).
我想将所有这些消息集中到一个文件(例如属性文件)中。 Please tell me how to implement this in Extjs.
请告诉我如何在Extjs中实现这一点。
Create a Sencha CMD package to hold common stuff for your projects. 创建一个Sencha CMD 程序包,以保存项目的常用内容。 Include that package in each project's
app.json
file: 在每个项目的
app.json
文件中包含该软件包:
"requires": [
"my-common",
// other packages
],
Put the messages in a singleton: 将消息放在一个单例中:
Ext.define('MyCommon.Messages', {
singleton: true,
foo: 'Bar'
// .....
Use it in your projects: 在您的项目中使用它:
alert(MyCommon.Messages.foo)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.