diff --git a/docs/Formatting.md b/docs/Formatting.md index 0e0f410..997a979 100644 --- a/docs/Formatting.md +++ b/docs/Formatting.md @@ -60,62 +60,45 @@ If the message id literal value is not in the root of the dicitonary, `.` (dots)
{$_('deep.prop')}
``` -### Formatting utilities +### `$time(number: Date, options: MessageObject)` -The formatter method also provides some casing methods: - -- `_.upper` - transforms a localized message into uppercase; -- `_.lower` - transforms a localized message into lowercase; -- `_.capital` - capitalize a localized message; -- `_.title` - transforms the message into title case; - -```html -
{$_.upper('greeting.ask')}
- - -
{$_.lower('greeting.ask')}
- - -
{$_.capital('greeting.ask')}
- - -
{$_.title('greeting.ask')}
- -``` - -#### `_.time(time: Date, options: MessageObject): string` +`import { time } from 'svelte-i18n'` Formats a date object into a time string with the specified format. Please refer to the [#formats](#formats) section to see available formats. ```html -
{$_.time(new Date(2019, 3, 24, 23, 45))}
+
{$time(new Date(2019, 3, 24, 23, 45))}
-
{$_.time(new Date(2019, 3, 24, 23, 45), { format: 'medium' } )}
+
{$time(new Date(2019, 3, 24, 23, 45), { format: 'medium' } )}
``` -#### `_.date(date: Date, options: MessageObject): string` +#### `$date(date: Date, options: MessageObject)` + +`import { date } from 'svelte-i18n'` Formats a date object into a string with the specified format. Please refer to the [#formats](#formats) section to see available formats. ```html -
{$_.date(new Date(2019, 3, 24, 23, 45))}
+
{$date(new Date(2019, 3, 24, 23, 45))}
-
{$_.date(new Date(2019, 3, 24, 23, 45), { format: 'medium' } )}
+
{$date(new Date(2019, 3, 24, 23, 45), { format: 'medium' } )}
``` -#### `_.number(number: number, options: MessageObject): string` +#### `$number(number: number, options: MessageObject)` + +`import { number } from 'svelte-i18n'` Formats a number with the specified locale and format. Please refer to the [#formats](#formats) section to see available formats. ```html -
{$_.number(100000000)}
+
{$number(100000000)}
-
{$_.number(100000000, { locale: 'pt' })}
+
{$number(100000000, { locale: 'pt' })}
``` diff --git a/docs/Getting Started.md b/docs/Getting Started.md index ac7252e..e9a0740 100644 --- a/docs/Getting Started.md +++ b/docs/Getting Started.md @@ -26,7 +26,7 @@ There are two different ways of adding a new dicitonary of messages to a certain ##### 2.1 Synchronous -Just `import`/`require` your locale `.json` files and pass them to the [`addMessages(locale, dict)`](/docs/Methods.md#addmessages) method. +Just `import`/`require` your locale `.json` files and pass them to the [`addMessages(locale, dict)`](/docs/Methods.md#addmessage) method. ```js // src/i18n.js @@ -60,7 +60,7 @@ register('pt', () => import('./pt.json')) #### 3. Initializing -After populating your [`$dictionary`](/docs/Dictionary) with [`addMessages()`](/docs/Methods.md#addmessages) or registering loaders via [`register()`](/docs/Methods.md#register), you are ready to bootstrap the library. You can use [`init()`](/docs/Methods.md#init) to define the fallback locale, initial locale and other options of your app. +After populating your [`$dictionary`](/docs/Dictionary.md) with [`addMessages()`](/docs/Methods.md#addmessages) or registering loaders via [`register()`](/docs/Methods.md#register), you are ready to bootstrap the library. You can use [`init()`](/docs/Methods.md#init) to define the fallback locale, initial locale and other options of your app. ```js // src/i18n.js @@ -104,7 +104,7 @@ Please note that the `fallbackLocale` is always loaded, independent of the curre #### 4. Localizing your app -After having the initial locale set, you're ready to start localizing your app. Import the [`$format`](/docs/Formatting) method, or any of its aliases, to any component that needs to be translated. Then, just call [`$format`](/docs/Formatting) passing the message `id` on your layout and voila! 🎉 +After having the initial locale set, you're ready to start localizing your app. Import the [`$format`](/docs/Formatting.md) method, or any of its aliases, to any component that needs to be translated. Then, just call [`$format`](/docs/Formatting.md) passing the message `id` on your layout and voila! 🎉 ```svelte