spacecommands 3.5.3 → 3.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -49,12 +49,22 @@ class MessageHandler {
49
49
  this._instance = instance;
50
50
  (async () => {
51
51
  this._messages = messagePath ? await Promise.resolve(`${messagePath}`).then(s => __importStar(require(s))) : defualtMessages;
52
- for (const messageId of Object.keys(this._messages)) {
53
- for (const language of Object.keys(this._messages[messageId])) {
54
- const lowerCaseLanguage = language.toLowerCase();
55
- if (!this._languages.includes(lowerCaseLanguage)) {
56
- this._languages.push(lowerCaseLanguage);
52
+ const languages = this._messages['LANGUAGE_NOT_SUPPORTED'] || this._messages['NEW_LANGUAGE'];
53
+ if (languages) {
54
+ for (const language of Object.keys(languages)) {
55
+ this._languages.push(language.toLowerCase());
56
+ }
57
+ }
58
+ else {
59
+ // Fallback: Use the first message found if standard ones are missing (unlikely)
60
+ for (const messageId of Object.keys(this._messages)) {
61
+ for (const language of Object.keys(this._messages[messageId])) {
62
+ const lowerCaseLanguage = language.toLowerCase();
63
+ if (!this._languages.includes(lowerCaseLanguage)) {
64
+ this._languages.push(lowerCaseLanguage);
65
+ }
57
66
  }
67
+ break; // Only check the first message to avoid iterating config objects
58
68
  }
59
69
  }
60
70
  if (!this._languages.includes(instance.defaultLanguage)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spacecommands",
3
- "version": "3.5.3",
3
+ "version": "3.5.4",
4
4
  "main": "dist/index.js",
5
5
  "types": "./typings.d.ts",
6
6
  "typings": "./typings.d.ts",