You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A function to generate a JS string to replace the `__()` call with. It gets called for each localize function call (eg. `__(...)`) for each locale.
154
+
An object of functions to generate a JS string to replace the `__()` call with. The object key is the localize function name, and its function gets called for each localize function call (eg. `__(...)`) for each locale. This allows you to have multiple localization functions, with separate compilation logic for each of them.
155
+
156
+
Note, you cannot use both `functionName` and `localizeCompiler`. Simply set the function name as a key in the `localizeCompiler` object instead.
150
157
151
158
#### localizerArguments
152
159
An array of strings containing JavaScript expressions. The expressions are stringified arguments of the original call. So `localizerArguments[0]` will be a JavaScript expression containing the translation key.
// Enforce minimum requirement that first argument is a string
168
-
if(
169
-
!(
170
-
callExpressionNode.arguments.length>0
171
-
&&firstArgumentNode.type==='Literal'
172
-
&&typeoffirstArgumentNode.value==='string'
173
-
)
174
-
){
175
-
constlocation=callExpressionNode.loc!.start;
176
-
reportModuleWarning(
177
-
module,
178
-
newWebpackError(`[${name}] Ignoring confusing usage of localization function "${functionName}" in ${module.resource}:${location.line}:${location.column}`),
// Enforce minimum requirement that first argument is a string
164
+
if(
165
+
!(
166
+
callExpressionNode.arguments.length>0
167
+
&&firstArgumentNode.type==='Literal'
168
+
&&typeoffirstArgumentNode.value==='string'
169
+
)
170
+
){
171
+
constlocation=callExpressionNode.loc!.start;
172
+
reportModuleWarning(
187
173
module,
188
-
callExpressionNode,
174
+
newWebpackError(`[${name}] Ignoring confusing usage of localization function "${functionName}" in ${module.resource}:${location.line}:${location.column}`),
0 commit comments