From 08eb1554f3dc3a8553d62223b3ee433da9dfec80 Mon Sep 17 00:00:00 2001 From: Christian Kaisermann Date: Mon, 3 Feb 2020 13:38:22 -0300 Subject: [PATCH] =?UTF-8?q?docs:=20=E2=9C=8F=EF=B8=8F=20add=20TOCs=20to=20?= =?UTF-8?q?some=20docs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/Formatting.md | 18 ++++++++++++++++-- docs/Getting Started.md | 13 +++++++++++++ docs/Methods.md | 40 +++++++++++++++++++++++++++++----------- 3 files changed, 58 insertions(+), 13 deletions(-) diff --git a/docs/Formatting.md b/docs/Formatting.md index 997a979..b59a4d4 100644 --- a/docs/Formatting.md +++ b/docs/Formatting.md @@ -1,3 +1,17 @@ + + + + +- [Message syntax](#message-syntax) +- [`$format` or `$_` or `$t`](#format-or-_-or-t) +- [`$time(number: Date, options: MessageObject)`](#timenumber-date-options-messageobject) +- [`$date(date: Date, options: MessageObject)`](#datedate-date-options-messageobject) +- [`$number(number: number, options: MessageObject)`](#numbernumber-number-options-messageobject) +- [Formats](#formats) +- [Accessing formatters directly](#accessing-formatters-directly) + + + ### Message syntax Under the hood, `formatjs` is used for localizing your messages. It allows `svelte-i18n` to support the ICU message syntax. It is strongly recommended to read their documentation about it. @@ -74,7 +88,7 @@ Formats a date object into a time string with the specified format. Please refer ``` -#### `$date(date: Date, options: MessageObject)` +### `$date(date: Date, options: MessageObject)` `import { date } from 'svelte-i18n'` @@ -88,7 +102,7 @@ Formats a date object into a string with the specified format. Please refer to t ``` -#### `$number(number: number, options: MessageObject)` +### `$number(number: number, options: MessageObject)` `import { number } from 'svelte-i18n'` diff --git a/docs/Getting Started.md b/docs/Getting Started.md index 03d3ca8..67d7fba 100644 --- a/docs/Getting Started.md +++ b/docs/Getting Started.md @@ -1,5 +1,18 @@ ### Getting started + + + + +- [1. Locale dictionaries](#1-locale-dictionaries) +- [2. Adding locale dictionaries](#2-adding-locale-dictionaries) + - [2.1 Synchronous](#21-synchronous) + - [2.2 Asynchronous](#22-asynchronous) +- [3. Initializing](#3-initializing) +- [4. Localizing your app](#4-localizing-your-app) + + + #### 1. Locale dictionaries A locale dictionary is a regular JSON object which contains message definitions for a certain language. diff --git a/docs/Methods.md b/docs/Methods.md index 4f93ae9..93f12ab 100644 --- a/docs/Methods.md +++ b/docs/Methods.md @@ -1,4 +1,22 @@ -#### init + + + + +- [`init`](#init) +- [`getLocaleFromHostname`](#getlocalefromhostname) +- [`getLocaleFromPathname`](#getlocalefrompathname) +- [`getLocaleFromNavigator`](#getlocalefromnavigator) +- [`getLocaleFromQueryString`](#getlocalefromquerystring) +- [`getLocaleFromHash`](#getlocalefromhash) +- [`addMessages`](#addmessages) +- [`register`](#register) +- [`waitLocale`](#waitlocale) +- [`getDateFormatter`/`getTimeFormatter`/`getNumberFormatter`](#getdateformattergettimeformattergetnumberformatter) +- [`getMessageFormatter`](#getmessageformatter) + + + +#### `init` > `import { init } from 'svelte-i18n'` @@ -68,7 +86,7 @@ init({ ``` -#### getLocaleFromHostname +#### `getLocaleFromHostname` > `import { getLocaleFromHostname } from 'svelte-i18n' @@ -87,7 +105,7 @@ init({ }) ``` -#### getLocaleFromPathname +#### `getLocaleFromPathname` > `import { getLocaleFromPathname } from 'svelte-i18n' @@ -107,7 +125,7 @@ init({ }) ``` -#### getLocaleFromNavigator +#### `getLocaleFromNavigator` > `import { getLocaleFromNavigator } from 'svelte-i18n' @@ -127,7 +145,7 @@ init({ }) ``` -#### getLocaleFromQueryString +#### `getLocaleFromQueryString` > `import { getLocaleFromQueryString } from 'svelte-i18n' @@ -145,7 +163,7 @@ init({ }) ``` -#### getLocaleFromHash +#### `getLocaleFromHash` > `import { getLocaleFromHash } from 'svelte-i18n' @@ -165,7 +183,7 @@ init({ }) ``` -#### addMessages +#### `addMessages` `import { addMessages } from 'svelte-i18n` @@ -195,7 +213,7 @@ addMessages('pt', { field_2: 'Sobrenome' }) } ``` -#### register +#### `register` > `import { register } from 'svelte-i18n'` @@ -214,7 +232,7 @@ register('pt', () => import('./_locales/pt.json')) See [how to asynchronously load dictionaries](/svelte-i18n/blob/master/docs#22-asynchronous). -#### waitLocale +#### `waitLocale` > `import { waitLocale } from 'svelte-i18n'` @@ -243,7 +261,7 @@ Executes the queue of `locale`. If the queue isn't resolved yet, the same promis ### Low level API -#### getDateFormatter / getTimeFormatter / getNumberFormatter +#### `getDateFormatter`/`getTimeFormatter`/`getNumberFormatter` > `import { getDateFormatter, getNumberFormatter, getTimeFormatter } from 'svelte-i18n'` @@ -268,7 +286,7 @@ getNumberFormatter( Each of these methods return their respective [`Intl.xxxxFormatter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects#Internationalization) variant. Click [here](/docs/formatting.md#accessing-formatters-directly) for an example of usage. -#### getMessageFormatter +#### `getMessageFormatter` > `import { getMessageFormatter } from 'svelte-i18n'`