Firebase函数:存储lang常量

时间:2018-12-08 12:49:29

标签: javascript firebase google-cloud-functions

将语言常量存储在index.js中是个好主意吗?该常量用于推送通知。

还有,是否有适合lang常量的格式?谢谢。

const stringPushSomethingNew = "pushSomethingNew";
const stringPushTwoStuffAnd = "pushTwoStuffAnd";
const stringPushRentsSells = "pushRentsSells";
const stringPushRents = "pushRents";
const stringPushSells = "pushSells";

var mapStringsEn = new Object();
mapStringsEn[stringPushSomethingNew] = "Something new";
mapStringsEn[stringPushTwoStuffAnd] = "and";
mapStringsEn[stringPushRentsSells] = "rents out and sells";
mapStringsEn[stringPushRents] = "rents out";
mapStringsEn[stringPushSells] = "sells";

mapStringsEn["2000"] = "Gadget";
mapStringsEn["2001"] = "Mobile phone";
mapStringsEn["2002"] = "Smartphone";
mapStringsEn["2003"] = "Tablet";

0 个答案:

没有答案