MCPcopy Create free account
hub / github.com/violentmonkey/violentmonkey / getData

Method getData

scripts/i18n.js:106–126  ·  view source on GitHub ↗
(lang, options)

Source from the content-addressed store, hash-verified

104 }
105
106 getData(lang, options) {
107 options = options || {};
108 const data = {};
109 const langData = this.locales[lang];
110 const defaultData = options.useDefaultLang && lang !== this.defaultLang
111 ? this.locales[this.defaultLang]
112 : null;
113 const colons = defaultData && !/^(ja|ko|zh)/.test(lang);
114 Object.keys(this.data).forEach(key => {
115 if (options.touchedOnly && !this.data[key].touched) return;
116 const msg = langData.getMessage(key) || defaultData?.getMessage(key) || '';
117 data[key] = {
118 description: this.data[key].description || this.newLocaleItem,
119 message: colons
120 ? normalizeTrailingColon(msg, defaultData.getMessage(key))
121 : msg,
122 };
123 if (options.markUntouched && !this.data[key].touched) data[key].touched = false;
124 });
125 return data;
126 }
127
128 dump(options) {
129 options = { ...this.options, ...options };

Callers 3

dumpMethod · 0.95
index.jsFile · 0.80
getTempIdFunction · 0.80

Calls 3

normalizeTrailingColonFunction · 0.85
getMessageMethod · 0.80
testMethod · 0.45

Tested by

no test coverage detected