-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c335d76
commit 28c729f
Showing
27 changed files
with
259 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 8 additions & 8 deletions
16
packages/i18n/src/I18nLite.ts → packages/i18n/src/core/I18nCore.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
import DateTime from './DateTime.js'; | ||
import List from './List.js'; | ||
import RelativeTime from './RelativeTime.js'; | ||
|
||
export { | ||
DateTime, | ||
List, | ||
RelativeTime, | ||
}; | ||
export { default as DateTime } from './DateTime.js'; | ||
export { default as List } from './List.js'; | ||
export { default as RelativeTime } from './RelativeTime.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { Getter } from '../types.js'; | ||
import $t, { type Parsed } from '../core/functions/$t.js'; | ||
|
||
export default <Getter>{ | ||
...$t, | ||
parse(args) { | ||
const [key, options] = args.replace(/\s/g, '').split(','); | ||
const d: Parsed = { | ||
k: key | ||
}; | ||
if (options) { | ||
d.o = Object.fromEntries(new URLSearchParams(options).entries()); | ||
} | ||
return d; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import type { FormatterFactory, NamedArgs, ParsedMessage, ParsedMessages, Translator } from './types.js'; | ||
import type I18nLite from './I18nLite.js'; | ||
import type I18nCore from './core/I18nCore.js'; | ||
export default class Locale extends Map<string, ParsedMessage> { | ||
formatters: Record<string, FormatterFactory>; | ||
readonly i18n: I18nLite; | ||
readonly i18n: I18nCore; | ||
readonly locale_id: string; | ||
constructor(i18n: I18nLite, locale_id: string, messages: ParsedMessages); | ||
constructor(i18n: I18nCore, locale_id: string, messages: ParsedMessages); | ||
createTranslator(): Translator; | ||
t(key: string, args?: NamedArgs): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { FactoryLocaleInserter, Getter, I18nCoreOptions, Locales, NamedArg, NamedArgs, ParsedMessages, Translator } from '../types.js'; | ||
import Locale from './Locale.js'; | ||
export default class I18nCore { | ||
default_locale_id: string; | ||
formatters: Record<string, FactoryLocaleInserter<unknown>>; | ||
getters: Record<string, Omit<Getter, 'parse'>>; | ||
locales: Locales; | ||
nested_limit: number; | ||
constructor(options?: Partial<I18nCoreOptions>); | ||
createTranslator(locale_id: string): Translator; | ||
loadParsed(locale_id: string, messages: ParsedMessages): Locale; | ||
resolve(obj: NamedArgs, key: string): NamedArg | undefined; | ||
t(locale_id: string, key: string, args?: NamedArgs, nested?: number): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import type { FormatterFactory, NamedArgs, ParsedMessage, ParsedMessages, Translator } from '../types.js'; | ||
import type I18nCore from './I18nCore.js'; | ||
export default class Locale extends Map<string, ParsedMessage> { | ||
formatters: Record<string, FormatterFactory>; | ||
readonly i18n: I18nCore; | ||
readonly locale_id: string; | ||
constructor(i18n: I18nCore, locale_id: string, messages: ParsedMessages); | ||
createTranslator(): Translator; | ||
t(key: string, args?: NamedArgs): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import type { Getter } from '../../types.js'; | ||
export declare type Parsed = { | ||
k: string; | ||
o?: { | ||
[key: string]: string; | ||
}; | ||
}; | ||
declare const _default: Omit<Getter, "parse">; | ||
export default _default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import type { Getter } from '../../types.js'; | ||
export declare type Parsed = { | ||
k: string; | ||
o?: { | ||
[key: string]: string; | ||
}; | ||
}; | ||
declare const _default: Omit<Getter, "parse">; | ||
export default _default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import DateTime from './DateTime.js'; | ||
import List from './List.js'; | ||
import RelativeTime from './RelativeTime.js'; | ||
export { DateTime, List, RelativeTime, }; | ||
export { default as DateTime } from './DateTime.js'; | ||
export { default as List } from './List.js'; | ||
export { default as RelativeTime } from './RelativeTime.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { Getter } from '../types'; | ||
import type { Getter } from '../types.js'; | ||
declare const _default: Getter; | ||
export default _default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import I18n from './I18n.js'; | ||
import I18nLite from './I18nLite.js'; | ||
export { I18n, I18nLite, }; | ||
export * from './types.js'; | ||
export { default as I18n } from './I18n.js'; | ||
export { default as I18nCore } from './core/I18nCore.js'; | ||
export * as formatters from './formatters/index.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import type { Getter } from '../types.js'; | ||
declare const _default: Getter; | ||
export default _default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.