warframe-worldstate-parser 2.25.1 → 2.25.2

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.
package/lib/News.js CHANGED
@@ -5,6 +5,7 @@ const WorldstateObject = require('./WorldstateObject');
5
5
  const updateReg = /(update|hotfix)/i;
6
6
  const primeAccessReg = /(access)/i;
7
7
  const streamReg = /(devstream|prime-time|warframeinternational|stream)/i;
8
+ const langString = /(\/Lotus\/Language\/)/i;
8
9
 
9
10
  /**
10
11
  * Represents a game news item
@@ -15,10 +16,11 @@ class News extends WorldstateObject {
15
16
  * @param {Object} data The news data
16
17
  * @param {Dependency} deps The dependencies object
17
18
  * @param {MarkdownSettings} deps.mdConfig The markdown settings
19
+ * @param {Translator} deps.translator The string translator
18
20
  * @param {TimeDateFunctions} deps.timeDate The time and date functions
19
21
  * @param {locale} deps.locale Locale to use for determining language
20
22
  */
21
- constructor(data, { mdConfig, timeDate, locale }) {
23
+ constructor(data, { mdConfig, translator, timeDate, locale }) {
22
24
  super(data, { timeDate });
23
25
 
24
26
  /**
@@ -42,6 +44,9 @@ class News extends WorldstateObject {
42
44
  * @type {string}
43
45
  */
44
46
  this.message = (data.Messages.find((msg) => msg.LanguageCode === locale) || { Message: '' }).Message;
47
+ if (langString.test(this.message)) {
48
+ this.message = translator.languageString(this.message, locale);
49
+ }
45
50
 
46
51
  /**
47
52
  * The link to the forum post
@@ -115,6 +120,10 @@ class News extends WorldstateObject {
115
120
  */
116
121
  this.translations = {};
117
122
  data.Messages.forEach((message) => {
123
+ if (langString.test(message)) {
124
+ this.translations[message.LanguageCode] = translator.languageString(message, message.LanguageCode);
125
+ }
126
+
118
127
  this.translations[message.LanguageCode] = message.Message;
119
128
  });
120
129
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "warframe-worldstate-parser",
3
- "version": "2.25.1",
3
+ "version": "2.25.2",
4
4
  "description": "An Open parser for Warframe's Worldstate in Javascript",
5
5
  "types": "./types/main.d.ts",
6
6
  "main": "main.js",
@@ -8,10 +8,11 @@ declare class News extends WorldstateObject {
8
8
  * @param {Object} data The news data
9
9
  * @param {Dependency} deps The dependencies object
10
10
  * @param {MarkdownSettings} deps.mdConfig The markdown settings
11
+ * @param {Translator} deps.translator The string translator
11
12
  * @param {TimeDateFunctions} deps.timeDate The time and date functions
12
13
  * @param {locale} deps.locale Locale to use for determining language
13
14
  */
14
- constructor(data: any, { mdConfig, timeDate, locale }: Dependency);
15
+ constructor(data: any, { mdConfig, translator, timeDate, locale }: Dependency);
15
16
  /**
16
17
  * The markdown settings
17
18
  * @type {MarkdownSettings}