mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
[feat] changed proton logs tippy text
* fixed issue with translation code where strings with "[]" characters throws an error
This commit is contained in:
@@ -5,6 +5,7 @@ import { ConfigurationService } from "./configuration.service";
|
||||
import { getProperty } from "dot-prop";
|
||||
import { i18n } from "dateformat";
|
||||
import { createElement, Fragment } from "react";
|
||||
import { logRenderError } from "renderer";
|
||||
|
||||
export class I18nService {
|
||||
private static instance: I18nService;
|
||||
@@ -79,7 +80,13 @@ export class I18nService {
|
||||
public translate(translationKey: string, args?: Record<string, string>): string {
|
||||
let translated = this.cache.get(translationKey);
|
||||
if (!translated) {
|
||||
translated = getProperty(this.dictionary, translationKey) ?? translationKey;
|
||||
try {
|
||||
translated = getProperty(this.dictionary, translationKey) ?? translationKey;
|
||||
} catch (error) {
|
||||
// Invalid translationKey like strings containing "[]"
|
||||
logRenderError(`Could not get property of ${translationKey}`, error);
|
||||
translated = translationKey;
|
||||
}
|
||||
this.cache.set(translationKey, translated);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user