Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
robisim74 committed Jul 16, 2020
1 parent 0acffd9 commit bffe34d
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 21 deletions.
1 change: 0 additions & 1 deletion docs/guards/L10nResolver.html
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ <h3 id="methods">
constructor(private translation: L10nTranslationService) { }

async resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise&lt;void&gt; {
await this.translation.init();
await this.translation.loadTranslation(route.data.l10nProviders);
}
}
Expand Down
10 changes: 6 additions & 4 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ <h3 id="configuration">Configuration</h3>

const i18nAsset = {
&#39;en-US&#39;: {
greeting: &quot;Hello world!&quot;,
whoIAm: &quot;I am {{name}}&quot;
greeting: &#39;Hello world!&#39;,
whoIAm: &#39;I am {{name}}&#39;
},
&#39;it-IT&#39;: {
greeting: &quot;Ciao mondo!&quot;,
whoIAm: &quot;Sono {{name}}&quot;
greeting: &#39;Ciao mondo!&#39;,
whoIAm: &#39;Sono {{name}}&#39;
}
};</code></pre></div><p>Import the modules and the configuration:</p>
<div><pre class="line-numbers"><code class="language-TypeScript">&#64;NgModule({
Expand Down Expand Up @@ -337,6 +337,8 @@ <h2 id="intl-api">Intl API</h2>
<li><a href="https://formatjs.io/docs/polyfills">Format.JS</a></li>
</ul>
<p>The <code>L10nIntlService</code> also provides methods for other APIs, such as <em>Collator</em>, <em>PluralRules</em> and <em>ListFormat</em>.</p>
<h3 id="intl-api-in-nodejs-environment">Intl API in Node.js environment</h3>
<p>To use <em>Intl</em> in <em>Node.js</em>, check the support according to the version in the official documentation: <a href="https://nodejs.org/api/intl.html">Internationalization Support</a></p>
<h2 id="previous-versions">Previous versions</h2>
<ul>
<li><p><strong>Angular v9 (Angular l10n v9.3.0)</strong></p>
Expand Down
2 changes: 1 addition & 1 deletion docs/injectables/L10nDefaultUserLanguage.html
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ <h3 id="methods">

public get(): Promise&lt;string | null&gt; {
let browserLanguage &#x3D; null;
if (navigator !&#x3D;&#x3D; undefined &amp;&amp; navigator.language) {
if (typeof navigator !&#x3D;&#x3D; &#x27;undefined&#x27; &amp;&amp; navigator.language) {
switch (this.config.format) {
case &#x27;language&#x27;:
browserLanguage &#x3D; navigator.language.split(&#x27;-&#x27;)[0];
Expand Down
27 changes: 15 additions & 12 deletions docs/injectables/L10nTranslationService.html
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ <h3 id="methods">

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="185"
class="link-to-prism">projects/angular-l10n/src/lib/services/l10n-translation.service.ts:185</a></div>
<div class="io-line">Defined in <a href="" data-line="188"
class="link-to-prism">projects/angular-l10n/src/lib/services/l10n-translation.service.ts:188</a></div>
</td>
</tr>

Expand Down Expand Up @@ -598,8 +598,8 @@ <h3 id="methods">

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="191"
class="link-to-prism">projects/angular-l10n/src/lib/services/l10n-translation.service.ts:191</a></div>
<div class="io-line">Defined in <a href="" data-line="194"
class="link-to-prism">projects/angular-l10n/src/lib/services/l10n-translation.service.ts:194</a></div>
</td>
</tr>

Expand Down Expand Up @@ -682,8 +682,8 @@ <h3 id="methods">

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="213"
class="link-to-prism">projects/angular-l10n/src/lib/services/l10n-translation.service.ts:213</a></div>
<div class="io-line">Defined in <a href="" data-line="216"
class="link-to-prism">projects/angular-l10n/src/lib/services/l10n-translation.service.ts:216</a></div>
</td>
</tr>

Expand Down Expand Up @@ -899,8 +899,8 @@ <h3 id="methods">

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="153"
class="link-to-prism">projects/angular-l10n/src/lib/services/l10n-translation.service.ts:153</a></div>
<div class="io-line">Defined in <a href="" data-line="156"
class="link-to-prism">projects/angular-l10n/src/lib/services/l10n-translation.service.ts:156</a></div>
</td>
</tr>

Expand Down Expand Up @@ -1086,8 +1086,8 @@ <h3 id="methods">

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="217"
class="link-to-prism">projects/angular-l10n/src/lib/services/l10n-translation.service.ts:217</a></div>
<div class="io-line">Defined in <a href="" data-line="220"
class="link-to-prism">projects/angular-l10n/src/lib/services/l10n-translation.service.ts:220</a></div>
</td>
</tr>

Expand Down Expand Up @@ -1562,10 +1562,13 @@ <h3 id="inputs">
* Should only be called when the service instance is created.
*/
public async init(): Promise&lt;void&gt; {
if (this.locale.language) return Promise.resolve();
// Checks whether the L10nRoutingService has already initialized the locale.
let locale: L10nLocale | null &#x3D; this.locale.language ? this.locale : null;

// Tries to get the locale from the storage.
let locale &#x3D; await this.storage.read();
if (locale &#x3D;&#x3D; null) {
locale &#x3D; await this.storage.read();
}
// Tries to get the locale through the user language.
if (locale &#x3D;&#x3D; null) {
const browserLanguage &#x3D; await this.userLanguage.get();
Expand Down
2 changes: 1 addition & 1 deletion docs/injectables/L10nUserLanguage.html
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ <h3 id="methods">

public get(): Promise&lt;string | null&gt; {
let browserLanguage &#x3D; null;
if (navigator !&#x3D;&#x3D; undefined &amp;&amp; navigator.language) {
if (typeof navigator !&#x3D;&#x3D; &#x27;undefined&#x27; &amp;&amp; navigator.language) {
switch (this.config.format) {
case &#x27;language&#x27;:
browserLanguage &#x3D; navigator.language.split(&#x27;-&#x27;)[0];
Expand Down
4 changes: 2 additions & 2 deletions docs/js/search/search_index.js

Large diffs are not rendered by default.

0 comments on commit bffe34d

Please sign in to comment.