Skip to content

Commit a2bb476

Browse files
fix some typos (#300)
1 parent eb6f58b commit a2bb476

29 files changed

+122
-122
lines changed

packages/core-base/src/compile.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ export function compileToFunction<T = string>(
4848
}
4949

5050
// compile error detecting
51-
let occured = false
51+
let occurred = false
5252
const onError = options.onError || defaultOnError
5353
options.onError = (err: CompileError): void => {
54-
occured = true
54+
occurred = true
5555
onError(err)
5656
}
5757

@@ -61,7 +61,7 @@ export function compileToFunction<T = string>(
6161
// evaluate function
6262
const msg = new Function(`return ${code}`)() as MessageFunction<T>
6363

64-
// if occured compile error, don't cache
65-
return !occured ? ((compileCache as MessageFunctions<T>)[key] = msg) : msg
64+
// if occurred compile error, don't cache
65+
return !occurred ? ((compileCache as MessageFunctions<T>)[key] = msg) : msg
6666
}
6767
}

packages/core-base/src/datetime.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export interface DateTimeOptions {
100100
fallbackWarn?: boolean
101101
/**
102102
* @remarks
103-
* Whether to use [Intel.DateTimeForrmat#formatToParts](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts)
103+
* Whether to use [Intel.DateTimeFormat#formatToParts](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts)
104104
*/
105105
part?: boolean
106106
}
@@ -144,7 +144,7 @@ export function datetime<DateTimeFormats, Message = string>(
144144
return MISSING_RESOLVE_VALUE
145145
}
146146

147-
const [key, value, options, orverrides] = parseDateTimeArgs(...args)
147+
const [key, value, options, overrides] = parseDateTimeArgs(...args)
148148
const missingWarn = isBoolean(options.missingWarn)
149149
? options.missingWarn
150150
: context.missingWarn
@@ -211,15 +211,15 @@ export function datetime<DateTimeFormats, Message = string>(
211211
}
212212

213213
let id = `${targetLocale}__${key}`
214-
if (!isEmptyObject(orverrides)) {
215-
id = `${id}__${JSON.stringify(orverrides)}`
214+
if (!isEmptyObject(overrides)) {
215+
id = `${id}__${JSON.stringify(overrides)}`
216216
}
217217

218218
let formatter = __datetimeFormatters.get(id)
219219
if (!formatter) {
220220
formatter = new Intl.DateTimeFormat(
221221
targetLocale,
222-
Object.assign({}, format, orverrides)
222+
Object.assign({}, format, overrides)
223223
)
224224
__datetimeFormatters.set(id, formatter)
225225
}
@@ -232,7 +232,7 @@ export function parseDateTimeArgs(
232232
): [string, number | Date, DateTimeOptions, Intl.DateTimeFormatOptions] {
233233
const [arg1, arg2, arg3, arg4] = args
234234
let options = {} as DateTimeOptions
235-
let orverrides = {} as Intl.DateTimeFormatOptions
235+
let overrides = {} as Intl.DateTimeFormatOptions
236236

237237
let value: number | Date
238238
if (isString(arg1)) {
@@ -269,14 +269,14 @@ export function parseDateTimeArgs(
269269
if (isString(arg3)) {
270270
options.locale = arg3
271271
} else if (isPlainObject(arg3)) {
272-
orverrides = arg3
272+
overrides = arg3
273273
}
274274

275275
if (isPlainObject(arg4)) {
276-
orverrides = arg4
276+
overrides = arg4
277277
}
278278

279-
return [options.key || '', value, options, orverrides]
279+
return [options.key || '', value, options, overrides]
280280
}
281281

282282
/** @internal */

packages/core-base/src/number.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export interface NumberOptions {
9494
fallbackWarn?: boolean
9595
/**
9696
* @remarks
97-
* Whether to use [Intel.NumberForrmat#formatToParts](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/formatToParts)
97+
* Whether to use [Intel.NumberFormat#formatToParts](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/formatToParts)
9898
*/
9999
part?: boolean
100100
}
@@ -138,7 +138,7 @@ export function number<NumberFormats, Message = string>(
138138
return MISSING_RESOLVE_VALUE
139139
}
140140

141-
const [key, value, options, orverrides] = parseNumberArgs(...args)
141+
const [key, value, options, overrides] = parseNumberArgs(...args)
142142
const missingWarn = isBoolean(options.missingWarn)
143143
? options.missingWarn
144144
: context.missingWarn
@@ -205,15 +205,15 @@ export function number<NumberFormats, Message = string>(
205205
}
206206

207207
let id = `${targetLocale}__${key}`
208-
if (!isEmptyObject(orverrides)) {
209-
id = `${id}__${JSON.stringify(orverrides)}`
208+
if (!isEmptyObject(overrides)) {
209+
id = `${id}__${JSON.stringify(overrides)}`
210210
}
211211

212212
let formatter = __numberFormatters.get(id)
213213
if (!formatter) {
214214
formatter = new Intl.NumberFormat(
215215
targetLocale,
216-
Object.assign({}, format, orverrides)
216+
Object.assign({}, format, overrides)
217217
)
218218
__numberFormatters.set(id, formatter)
219219
}
@@ -226,7 +226,7 @@ export function parseNumberArgs(
226226
): [string, number, NumberOptions, Intl.NumberFormatOptions] {
227227
const [arg1, arg2, arg3, arg4] = args
228228
let options = {} as NumberOptions
229-
let orverrides = {} as Intl.NumberFormatOptions
229+
let overrides = {} as Intl.NumberFormatOptions
230230

231231
if (!isNumber(arg1)) {
232232
throw createCoreError(CoreErrorCodes.INVALID_ARGUMENT)
@@ -242,14 +242,14 @@ export function parseNumberArgs(
242242
if (isString(arg3)) {
243243
options.locale = arg3
244244
} else if (isPlainObject(arg3)) {
245-
orverrides = arg3
245+
overrides = arg3
246246
}
247247

248248
if (isPlainObject(arg4)) {
249-
orverrides = arg4
249+
overrides = arg4
250250
}
251251

252-
return [options.key || '', value, options, orverrides]
252+
return [options.key || '', value, options, overrides]
253253
}
254254

255255
/** @internal */

packages/core-base/src/translate.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export interface TranslateOptions {
120120
plural?: number
121121
/**
122122
* @remarks
123-
* Default message when is occured translation missing
123+
* Default message when is occurred translation missing
124124
*/
125125
default?: string | boolean
126126
/**
@@ -223,7 +223,7 @@ export function translate<Messages, Message = string>(
223223
...args: unknown[]
224224
): MessageType<Message> | number // for internal
225225

226-
// implementationo of `translate` function
226+
// implementation of `translate` function
227227
export function translate<Messages, Message = string>(
228228
context: CoreTranslationContext<Messages, Message>,
229229
...args: unknown[]
@@ -302,13 +302,13 @@ export function translate<Messages, Message = string>(
302302
}
303303

304304
// setup compile error detecting
305-
let occured = false
305+
let occurred = false
306306
const errorDetector = () => {
307-
occured = true
307+
occurred = true
308308
}
309309

310310
// compile message format
311-
const msg = compileMessasgeFormat(
311+
const msg = compileMessageFormat(
312312
context,
313313
key,
314314
targetLocale,
@@ -317,8 +317,8 @@ export function translate<Messages, Message = string>(
317317
errorDetector
318318
)
319319

320-
// if occured compile error, return the message format
321-
if (occured) {
320+
// if occurred compile error, return the message format
321+
if (occurred) {
322322
return format as MessageType<Message>
323323
}
324324

@@ -336,7 +336,7 @@ export function translate<Messages, Message = string>(
336336
msgContext
337337
)
338338

339-
// if use post translation option, procee it with handler
339+
// if use post translation option, proceed it with handler
340340
return postTranslation ? postTranslation(messaged) : messaged
341341
}
342342

@@ -457,7 +457,7 @@ function resolveMessageFormat<Messages, Message>(
457457
return [format, targetLocale, message]
458458
}
459459

460-
function compileMessasgeFormat<Messages, Message>(
460+
function compileMessageFormat<Messages, Message>(
461461
context: CoreTranslationContext<Messages, Message>,
462462
key: string,
463463
targetLocale: string,
@@ -646,19 +646,19 @@ function getMessageContextOptions<Messages, Message = string>(
646646
const resolveMessage = (key: string): MessageFunction<Message> => {
647647
const val = resolveValue(message, key)
648648
if (isString(val)) {
649-
let occured = false
649+
let occurred = false
650650
const errorDetector = () => {
651-
occured = true
651+
occurred = true
652652
}
653-
const msg = (compileMessasgeFormat<Messages, Message>(
653+
const msg = (compileMessageFormat<Messages, Message>(
654654
context,
655655
key,
656656
locale,
657657
val,
658658
key,
659659
errorDetector
660660
) as unknown) as MessageFunction<Message>
661-
return !occured
661+
return !occurred
662662
? msg
663663
: (NOOP_MESSAGE_FUNCTION as MessageFunction<Message>)
664664
} else if (isMessageFunction<Message>(val)) {

packages/core-base/test/datetime.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,4 +346,4 @@ describe('error', () => {
346346
})
347347
})
348348

349-
/* eslint-eable @typescript-eslint/no-empty-function */
349+
/* eslint-enable @typescript-eslint/no-empty-function */

packages/core-base/test/emitter.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ test('basic', () => {
1515
expect(handler).toBeCalledTimes(1)
1616
})
1717

18-
test('mlutiple reigster', () => {
18+
test('multiple register', () => {
1919
const handler1 = jest.fn()
2020
const handler2 = jest.fn()
2121

packages/core-base/test/translate.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ describe('context fallbackFormat option', () => {
434434
)
435435
})
436436

437-
test('overrided with default option', () => {
437+
test('overridden with default option', () => {
438438
const mockWarn = warn as jest.MockedFunction<typeof warn>
439439
mockWarn.mockImplementation(() => {})
440440

packages/message-compiler/src/errors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ export const errorMessages: { [code: number]: string } = {
6868
export function createCompileError<T extends number>(
6969
code: T,
7070
loc: SourceLocation | null,
71-
optinos: CreateCompileErrorOptions = {}
71+
options: CreateCompileErrorOptions = {}
7272
): CompileError {
73-
const { domain, messages, args } = optinos
73+
const { domain, messages, args } = options
7474
const msg = __DEV__
7575
? format((messages || errorMessages)[code] || '', ...(args || []))
7676
: code

packages/message-compiler/src/parser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ export function createParser(options: ParserOptions = {}): Parser {
543543
}
544544
node.body = parseResource(tokenizer)
545545

546-
// assert wheather achieved to EOF
546+
// assert whether achieved to EOF
547547
if (context.currentType !== TokenTypes.EOF) {
548548
emitError(
549549
tokenizer,

packages/message-compiler/src/tokenizer.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ export function createTokenizer(
323323
scnr.peek()
324324
return fn()
325325
} else {
326-
// other charactors
326+
// other characters
327327
return isIdentifierStart(ch)
328328
}
329329
}
@@ -725,7 +725,7 @@ export function createTokenizer(
725725
default:
726726
let validNamedIdentifier = true
727727
let validListIdentifier = true
728-
let validLeteral = true
728+
let validLiteral = true
729729

730730
if (isPluralStart(scnr)) {
731731
if (context.braceNest > 0) {
@@ -774,14 +774,14 @@ export function createTokenizer(
774774
return token
775775
}
776776

777-
if ((validLeteral = isLiteralStart(scnr, context))) {
777+
if ((validLiteral = isLiteralStart(scnr, context))) {
778778
token = getToken(context, TokenTypes.Literal, readLiteral(scnr))
779779

780780
skipSpaces(scnr)
781781
return token
782782
}
783783

784-
if (!validNamedIdentifier && !validListIdentifier && !validLeteral) {
784+
if (!validNamedIdentifier && !validListIdentifier && !validLiteral) {
785785
// TODO: we should be re-designed invalid cases, when we will extend message syntax near the future ...
786786
token = getToken(
787787
context,

0 commit comments

Comments
 (0)