Add prefer optional chaining rule
This commit is contained in:
@@ -37,7 +37,7 @@ function getDefaultLanguage() {
|
||||
if (navigator.userLanguage) {
|
||||
return navigator.userLanguage;
|
||||
}
|
||||
if (navigator.languages && navigator.languages.length) {
|
||||
if (navigator.languages?.length) {
|
||||
return navigator.languages[0];
|
||||
}
|
||||
|
||||
@@ -217,12 +217,12 @@ function translateKey(key) {
|
||||
|
||||
function translateKeyFromModule(key, module) {
|
||||
let dictionary = getDictionary(module, getCurrentLocale());
|
||||
if (dictionary && dictionary[key]) {
|
||||
if (dictionary?.[key]) {
|
||||
return dictionary[key];
|
||||
}
|
||||
|
||||
dictionary = getDictionary(module, fallbackCulture);
|
||||
if (dictionary && dictionary[key]) {
|
||||
if (dictionary?.[key]) {
|
||||
return dictionary[key];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user