summaryrefslogtreecommitdiffhomepage
path: root/gui/src
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2020-04-14 11:56:05 +0200
committerAndrej Mihajlov <and@mullvad.net>2020-04-14 11:56:05 +0200
commit492e18f9afd63e036a83d37996a17c30cb6896c8 (patch)
tree3ec28303f5b430f0d7056e2862b9af64e7824eea /gui/src
parent8955093b5235ae5e379491b865b824822d58ebfe (diff)
parente4aeb0cbf8d4b5133043e5994bd98adee3d64277 (diff)
downloadmullvadvpn-492e18f9afd63e036a83d37996a17c30cb6896c8.tar.xz
mullvadvpn-492e18f9afd63e036a83d37996a17c30cb6896c8.zip
Merge branch 'update-node-gettext'
Diffstat (limited to 'gui/src')
-rw-r--r--gui/src/shared/gettext.ts21
1 files changed, 4 insertions, 17 deletions
diff --git a/gui/src/shared/gettext.ts b/gui/src/shared/gettext.ts
index 5f33190109..ee8e8bf8d0 100644
--- a/gui/src/shared/gettext.ts
+++ b/gui/src/shared/gettext.ts
@@ -67,29 +67,16 @@ function parseTranslation(locale: string, domain: string, catalogue: Gettext): b
function setErrorHandler(catalogue: Gettext) {
catalogue.on('error', (error) => {
- // NOTE: locale is not publicly exposed
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- const catalogueLocale = (catalogue as any).locale;
-
- // Filter out the "no translation was found" errors for the source language.
- // The catalogue's locale is set to an empty string when using the source translation.
- if (
- (catalogueLocale === '' || catalogueLocale === SOURCE_LANGUAGE) &&
- error.indexOf('No translation was found') !== -1
- ) {
- return;
- }
-
log.warn(`Gettext error: ${error}`);
});
}
-// `{debug: false}` option prevents Gettext from printing the warnings to console in development
-// the errors are handled separately in the "error" handler below
-export const messages = new Gettext({ debug: false });
+const gettextOptions = { sourceLocale: SOURCE_LANGUAGE };
+
+export const messages = new Gettext(gettextOptions);
messages.setTextDomain('messages');
setErrorHandler(messages);
-export const relayLocations = new Gettext({ debug: false });
+export const relayLocations = new Gettext(gettextOptions);
relayLocations.setTextDomain('relay-locations');
setErrorHandler(relayLocations);