-
Notifications
You must be signed in to change notification settings - Fork 3
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
Showing
22 changed files
with
950 additions
and
1,209 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
node_modules/ | ||
node_modules/ | ||
dist/ |
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,8 @@ | ||
Copyright (c) 2017 AgileBits Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,77 +1,2 @@ | ||
/// <reference path="../../node_modules/@types/react/index.d.ts" /> | ||
/** | ||
* T.js - lightweight localization | ||
* v0.2 | ||
* | ||
* T.js defers to standards to do the hard work of localization. The browser Intl API is use to format | ||
* dates and numbers. Messages are provided as functions rather than strings, so they can be compiled at build time. | ||
* | ||
* | ||
* Cobbled together by Mitch Cohen on July 31, 2017 | ||
*/ | ||
export declare type MFunc = (replacements?: Replacements) => string; | ||
export declare type Compiler = (message: string) => MFunc; | ||
export interface Replacements { | ||
[s: string]: any; | ||
} | ||
export interface Messages { | ||
[s: string]: { | ||
[s: string]: string | MFunc; | ||
}; | ||
} | ||
export interface SetupOptions { | ||
messages?: Messages; | ||
locale?: string; | ||
idGenerator?: (message: string) => string; | ||
compiler?: Compiler; | ||
} | ||
export interface PluralOptions { | ||
other: string; | ||
one?: string; | ||
zero?: string; | ||
} | ||
export interface TFunc { | ||
(message: string, replacements?: Replacements, id?: string): string; | ||
lookup?: (id: string, replacements?: Replacements, defaultMessage?: string) => string; | ||
setup?: (options?: SetupOptions) => any; | ||
date?: (value: any, formatName?: string, locale?: string) => string; | ||
number?: (value: any, formatName?: string, locale?: string) => string; | ||
$?: (message: string, replacements?: any, id?: string) => any[]; | ||
_i18nInstance?: I18n; | ||
} | ||
export declare type IntlFormat = Intl.DateTimeFormat | Intl.NumberFormat; | ||
export declare type IntlFormatType = (typeof Intl.DateTimeFormat | typeof Intl.NumberFormat); | ||
export declare type IntlFormatOptions = Intl.DateTimeFormatOptions | Intl.NumberFormatOptions; | ||
export declare type CachedFormatter = (locale: string, formatOptions?: IntlFormatOptions) => IntlFormat; | ||
export declare let dateTimeFormatOptions: { | ||
[s: string]: Intl.DateTimeFormatOptions; | ||
}; | ||
export declare let numberFormatOptions: { | ||
[s: string]: Intl.NumberFormatOptions; | ||
}; | ||
export declare const collationTable: string[]; | ||
export declare const defaultLanguage = "en"; | ||
export declare const generator: { | ||
plain(message: string): string; | ||
hyphens(message: string): string; | ||
}; | ||
export declare function Plural(pluralizeFor: string, options: PluralOptions): string; | ||
export declare function createCachedFormatter(intlFormat: (IntlFormatType)): CachedFormatter; | ||
export declare class I18n { | ||
locale: string; | ||
messages: Messages; | ||
idGenerator: (message: string) => any; | ||
dateFormatter: CachedFormatter; | ||
numberFormatter: CachedFormatter; | ||
compiler: Compiler; | ||
static defaultSetup: SetupOptions; | ||
constructor(options?: SetupOptions); | ||
format(type: string, value: number | Date, formatStyle?: string, locale?: string): any; | ||
getKey(key: string, locale?: string): MFunc | String; | ||
generateId(message: string): any; | ||
lookup(id: string, replacements?: Replacements, defaultMessage?: string): string; | ||
setup(options?: SetupOptions): SetupOptions; | ||
} | ||
export declare function i18nNamespace(): TFunc; | ||
export declare const T: TFunc; | ||
export declare const makeI18n: typeof i18nNamespace; | ||
export { Plural, generator } from "./helpers"; | ||
export { default as T, makeT } from "./t-i18n"; |
Oops, something went wrong.