Skip to content

Commit 31f5932

Browse files
authored
add some missing localization strings (#10479)
* localize type names and add react-common to strings * add missing function strings
1 parent 2f8aec6 commit 31f5932

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

cli/cli.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1830,6 +1830,9 @@ function saveThemeJson(cfg: pxt.TargetBundle, localDir?: boolean, packaged?: boo
18301830
if (extraType.label) {
18311831
targetStrings[`{id:type}${extraType.label}`] = extraType.label;
18321832
}
1833+
else {
1834+
targetStrings[`{id:type}${extraType.typeName}`] = extraType.typeName;
1835+
}
18331836

18341837
if (extraType.defaultName) {
18351838
targetStrings[`{id:var}${extraType.defaultName}`] = extraType.defaultName;

gulpfile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ function updatestrings() {
235235
"pxtpy",
236236
"pxtsim",
237237
"webapp/src",
238+
"react-common"
238239
], true);
239240
}
240241

pxtblocks/builtins/functions.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ export function initFunctions() {
2424
msg.FUNCTIONS_DEFAULT_STRING_ARG_NAME = lf("text");
2525
msg.FUNCTIONS_DEFAULT_NUMBER_ARG_NAME = lf("num");
2626
msg.FUNCTIONS_DEFAULT_CUSTOM_ARG_NAME = lf("arg");
27+
msg.FUNCTION_FLYOUT_LABEL = lf("Your Functions");
28+
msg.FUNCTIONS_CREATE_CALL_OPTION = lf("Create 'call {0}'", "%1");
29+
msg.FUNCTIONS_DEFNORETURN_TITLE = lf("function");
2730
msg.PROCEDURES_HUE = pxt.toolbox.getNamespaceColor("functions");
2831
msg.REPORTERS_HUE = pxt.toolbox.getNamespaceColor("variables");
2932

webapp/src/createFunction.tsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -212,18 +212,19 @@ export class CreateFunctionDialog extends data.Component<ISettingsProps, CreateF
212212
}
213213
];
214214

215-
if (pxt.appTarget.runtime &&
216-
pxt.appTarget.runtime.functionsOptions &&
217-
pxt.appTarget.runtime.functionsOptions.extraFunctionEditorTypes &&
218-
Array.isArray(pxt.appTarget.runtime.functionsOptions.extraFunctionEditorTypes)) {
215+
const extraTypes = pxt.appTarget.runtime?.functionsOptions?.extraFunctionEditorTypes;
216+
217+
if (Array.isArray(extraTypes)) {
218+
for (const extraType of extraTypes) {
219+
const label = extraType.label || extraType.typeName;
220+
const defaultName = extraType.defaultName;
219221

220-
pxt.appTarget.runtime.functionsOptions.extraFunctionEditorTypes.forEach(t => {
221222
types.push({
222-
...t,
223-
label: t.label && pxt.Util.rlf(`{id:type}${t.label}`),
224-
defaultName: t.defaultName && pxt.Util.rlf(`{id:var}${t.defaultName}`)
225-
})
226-
});
223+
...extraType,
224+
label: pxt.Util.rlf(`{id:type}${label}`),
225+
defaultName: defaultName && pxt.Util.rlf(`{id:var}${defaultName}`)
226+
});
227+
}
227228
}
228229

229230
types.forEach(t => {

0 commit comments

Comments
 (0)