@quenty/clienttranslator 8.13.1 → 8.14.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [8.14.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/clienttranslator@8.13.1...@quenty/clienttranslator@8.14.0) (2023-03-28)
7
+
8
+
9
+ ### Features
10
+
11
+ * Add JSONTranslator:SetEntryValue(translationKey, source, context, localeId, text) ([3790994](https://github.com/Quenty/NevermoreEngine/commit/3790994ec62aceb475b7cddf7b2c30166dc27f96))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [8.13.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/clienttranslator@8.13.0...@quenty/clienttranslator@8.13.1) (2023-03-08)
7
18
 
8
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/clienttranslator",
3
- "version": "8.13.1",
3
+ "version": "8.14.0",
4
4
  "description": "Gets local translator for player",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -30,12 +30,12 @@
30
30
  "@quenty/loader": "^6.2.0",
31
31
  "@quenty/maid": "^2.5.0",
32
32
  "@quenty/promise": "^6.3.0",
33
- "@quenty/pseudolocalize": "^3.1.0",
33
+ "@quenty/pseudolocalize": "^3.2.0",
34
34
  "@quenty/rx": "^7.7.0",
35
35
  "@quenty/table": "^3.2.0"
36
36
  },
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "c7f3e8078b6ef3d934cd25ab5197cf453c079428"
40
+ "gitHead": "365473382344edb0db14d40c9392b9774214e29b"
41
41
  }
@@ -99,6 +99,33 @@ function JSONTranslator:ObserveLocaleId()
99
99
  })
100
100
  end
101
101
 
102
+ --[=[
103
+ Adds an entry value to the localization table itself. This can be useful
104
+ for ensuring pseudo localization and/or generating localization values
105
+ from the game data itself.
106
+
107
+ @param translationKey string
108
+ @param source string
109
+ @param context string
110
+ @param localeId string
111
+ @param text string
112
+ ]=]
113
+ function JSONTranslator:SetEntryValue(translationKey, source, context, localeId, text)
114
+ assert(type(translationKey) == "string", "Bad translationKey")
115
+ assert(type(source) == "string", "Bad source")
116
+ assert(type(context) == "string", "Bad context")
117
+ assert(type(localeId) == "string", "Bad localeId")
118
+ assert(type(text) == "string", "Bad text")
119
+
120
+ self._localizationTable:SetEntryValue(translationKey, source, context, localeId, text or source)
121
+
122
+ if RunService:IsStudio() then
123
+ self._localizationTable:SetEntryValue(translationKey, source, context,
124
+ PseudoLocalize.getDefaultPseudoLocaleId(),
125
+ PseudoLocalize.pseudoLocalize(text))
126
+ end
127
+ end
128
+
102
129
  --[=[
103
130
  Gets the current localeId of the translator if it's initialized, or a default if it is not.
104
131