BetterDiscordApp-rauenzi/renderer/src/modules/strings.js

22 lines
664 B
JavaScript
Raw Normal View History

2019-06-27 06:21:51 +02:00
import LocaleManager from "./localemanager";
2019-06-25 22:36:34 +02:00
import FormattableString from "../structs/string";
2019-06-27 04:31:18 +02:00
2019-06-27 06:21:51 +02:00
export default new Proxy(LocaleManager.strings, {
get: function(strings, category) {
2019-06-25 22:36:34 +02:00
if (!strings.hasOwnProperty(category)) {
return new Proxy({}, {
get: function() {
return `String group "${category}" not found.`;
}
});
}
return new Proxy(strings[category], {
get: function(obj, prop) {
if (typeof(obj[prop]) == "string") return new FormattableString(obj[prop]);
return obj[prop];
}
});
}
2019-06-24 21:47:24 +02:00
});