MCPcopy Index your code
hub / github.com/OneNoteDev/WebClipper / fetchAndStoreLocStrings

Function fetchAndStoreLocStrings

src/scripts/extensions/extensionBase.ts:131–148  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

129 }
130
131 protected fetchAndStoreLocStrings(): Promise<{}> {
132 // navigator.userLanguage is only available in IE, and Typescript will not recognize this property
133 let locale = navigator.language || (<any>navigator).userLanguage;
134
135 return LocalizationHelper.makeLocStringsFetchRequest(locale).then((responsePackage) => {
136 try {
137 let locStringsDict = JSON.parse(responsePackage.parsedResponse);
138 if (locStringsDict) {
139 this.clipperData.setValue(ClipperStorageKeys.locale, locale);
140 this.clipperData.setValue(ClipperStorageKeys.locStrings, responsePackage.parsedResponse);
141 Localization.setLocalizedStrings(locStringsDict);
142 }
143 return Promise.resolve(locStringsDict);
144 } catch (e) {
145 return Promise.reject(undefined);
146 }
147 });
148 }
149
150 /**
151 * Returns the URL for more information about the Clipper

Callers

nothing calls this directly

Calls 2

setValueMethod · 0.65

Tested by

no test coverage detected