Skip to content

Commit e0d029c

Browse files
Fix misread keys for translations
1 parent d85d212 commit e0d029c

File tree

1 file changed

+14
-26
lines changed

1 file changed

+14
-26
lines changed

scripts/extract-all-translations.js

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ try {
100100
const eventsFunctions = data.eventsFunctions;
101101

102102
if (Array.isArray(eventsFunctions)) {
103-
eventsFunctions.forEach((func) => {
103+
eventsFunctions.forEach((eventsFunction) => {
104104
['description', 'fullName', 'sentence'].forEach((key) => {
105-
if (func[key]) {
106-
const value = func[key].trim();
105+
if (eventsFunction[key]) {
106+
const value = eventsFunction[key].trim();
107107
if (value) {
108108
if (!translationsMap.has(value)) {
109109
translationsMap.set(value, []);
@@ -113,7 +113,7 @@ try {
113113
}
114114
});
115115

116-
const parameters = func.parameters;
116+
const parameters = eventsFunction.parameters;
117117
if (Array.isArray(parameters)) {
118118
parameters.forEach((param) => {
119119
['description', 'longDescription'].forEach((key) => {
@@ -142,10 +142,10 @@ try {
142142
const eventsBasedBehaviors = data.eventsBasedBehaviors;
143143

144144
if (Array.isArray(eventsBasedBehaviors)) {
145-
eventsBasedBehaviors.forEach((func) => {
145+
eventsBasedBehaviors.forEach((eventsBasedBehavior) => {
146146
['description', 'fullName'].forEach((key) => {
147-
if (func[key]) {
148-
const value = func[key].trim();
147+
if (eventsBasedBehavior[key]) {
148+
const value = eventsBasedBehavior[key].trim();
149149
if (value) {
150150
if (!translationsMap.has(value)) {
151151
translationsMap.set(value, []);
@@ -155,14 +155,8 @@ try {
155155
}
156156
});
157157

158-
getAndAddPropertyDescriptorsPropsForFile(func, filePath);
159-
160-
const behaviorEventsFunctions = func.eventsFunctions;
161-
if (Array.isArray(behaviorEventsFunctions)) {
162-
behaviorEventsFunctions.forEach((func) => {
163-
getAndAddEventsFunctionsPropsForFile(func, filePath);
164-
});
165-
}
158+
getAndAddPropertyDescriptorsPropsForFile(eventsBasedBehavior, filePath);
159+
getAndAddEventsFunctionsPropsForFile(eventsBasedBehavior, filePath);
166160
});
167161
}
168162
};
@@ -176,10 +170,10 @@ try {
176170
const eventsBasedObjects = data.eventsBasedObjects;
177171

178172
if (Array.isArray(eventsBasedObjects)) {
179-
eventsBasedObjects.forEach((func) => {
173+
eventsBasedObjects.forEach((eventsBasedObject) => {
180174
['description', 'fullName'].forEach((key) => {
181-
if (func[key]) {
182-
const value = func[key].trim();
175+
if (eventsBasedObject[key]) {
176+
const value = eventsBasedObject[key].trim();
183177
if (value) {
184178
if (!translationsMap.has(value)) {
185179
translationsMap.set(value, []);
@@ -189,14 +183,8 @@ try {
189183
}
190184
});
191185

192-
getAndAddPropertyDescriptorsPropsForFile(func, filePath);
193-
194-
const behaviorEventsFunctions = func.eventsFunctions;
195-
if (Array.isArray(behaviorEventsFunctions)) {
196-
behaviorEventsFunctions.forEach((func) => {
197-
getAndAddEventsFunctionsPropsForFile(func, filePath);
198-
});
199-
}
186+
getAndAddPropertyDescriptorsPropsForFile(eventsBasedObject, filePath);
187+
getAndAddEventsFunctionsPropsForFile(eventsBasedObject, filePath);
200188
});
201189
}
202190
};

0 commit comments

Comments
 (0)