Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
robisim74 committed Apr 7, 2021
1 parent 5140c8c commit 2d52c42
Show file tree
Hide file tree
Showing 18 changed files with 134 additions and 107 deletions.
15 changes: 10 additions & 5 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,18 @@ <h3 id="configuration">Configuration</h3>
const i18nAsset = {
&#39;en-US&#39;: {
greeting: &#39;Hello world!&#39;,
whoIAm: &#39;I am {{name}}&#39;
whoIAm: &#39;I am {{name}}&#39;,
one: &#39;software developer&#39;
},
&#39;it-IT&#39;: {
greeting: &#39;Ciao mondo!&#39;,
whoIAm: &#39;Sono {{name}}&#39;
whoIAm: &#39;Sono {{name}}&#39;,
one: &#39;sviluppatore software&#39;
}
};</code></pre></div><p>Import the modules and the configuration:</p>
};</code></pre></div><blockquote>
<p>Do you only need to localize and not translate? Give the <code>providers</code> an empty array, but provide the supported locales in the <code>schema</code> anyway</p>
</blockquote>
<p>Import the modules and the configuration:</p>
<div><pre class="line-numbers"><code class="language-TypeScript">&#64;NgModule({
...
imports: [
Expand Down Expand Up @@ -111,7 +116,7 @@ <h4 id="pure-pipes">Pure Pipes</h4>

&lt;p&gt;{{ value | l10nNumber:locale.language:{ digits: &#39;1.2-2&#39;, style: &#39;currency&#39; } }}&lt;/p&gt;

&lt;p&gt;1 {{ 1 | l10nPlural:locale.language:&#39;home&#39;:{ type: &#39;cardinal&#39; } }}&lt;/p&gt;
&lt;p&gt;1 {{ 1 | l10nPlural:locale.language }}&lt;/p&gt;

&lt;button *ngFor=&quot;let item of schema&quot;
(click)=&quot;setLocale(item.locale)&quot;&gt;{{ item.locale.language | l10nDisplayNames:locale.language:{ type: &#39;language&#39; } }}&lt;/button&gt;</code></pre></div><p>Pure pipes need to know when the <em>locale</em> changes. So import <code>L10nLocale</code> injection token in the component:</p>
Expand Down Expand Up @@ -144,7 +149,7 @@ <h4 id="apis">APIs</h4>
this.formattedToday = this.intl.formatDate(this.today, { dateStyle: &#39;full&#39;, timeStyle: &#39;short&#39; });
this.formattedTimeAgo = this.intl.formatRelativeTime(this.timeAgo, &#39;second&#39;, { numeric: &#39;always&#39;, style: &#39;long&#39; });
this.formattedValue = this.intl.formatNumber(this.value, { digits: &#39;1.2-2&#39;, style: &#39;currency&#39; });
this.formattedOnePlural = this.intl.plural(1, &#39;home&#39;, { type: &#39;cardinal&#39; });
this.formattedOnePlural = this.intl.plural(1);
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion docs/injectables/L10nDefaultLoader.html
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ <h3 id="methods">
/**
* This method must contain the logic to init L10n.
*/
public abstract async init(): Promise&lt;void&gt;;
public abstract init(): Promise&lt;void&gt;;

}

Expand Down
23 changes: 18 additions & 5 deletions docs/injectables/L10nDefaultMissingTranslationHandler.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@ <h3 id="methods">
<tr>
<td class="col-md-4">
<span class="modifier-icon icon ion-ios-reset"></span>
<code>handle(key: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>, value?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>)</code>
<code>handle(key: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>, value?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>, params?: <a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank">any</a>)</code>
</td>
</tr>


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

Expand Down Expand Up @@ -164,6 +164,18 @@ <h3 id="methods">
</td>


</tr>
<tr>
<td>params</td>
<td>
<code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >any</a></code>
</td>

<td>
Yes
</td>


</tr>
</tbody>
</table>
Expand Down Expand Up @@ -198,15 +210,16 @@ <h3 id="methods">
* This method must contain the logic to handle missing values.
* @param key The key that has been requested
* @param value Null or empty string
* @param params Optional parameters contained in the key
* @return The value
*/
public abstract handle(key: string, value?: string): string | any;
public abstract handle(key: string, value?: string, params?: any): string | any;

}

@Injectable() export class L10nDefaultMissingTranslationHandler implements L10nMissingTranslationHandler {

public handle(key: string, value?: string): string | any {
public handle(key: string, value?: string, params?: any): string | any {
return key;
}

Expand Down
4 changes: 2 additions & 2 deletions docs/injectables/L10nDefaultStorage.html
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,13 @@ <h3 id="methods">
* This method must contain the logic to read the storage.
* @return A promise with the value of the locale
*/
public abstract async read(): Promise&lt;L10nLocale | null&gt;;
public abstract read(): Promise&lt;L10nLocale | null&gt;;

/**
* This method must contain the logic to write the storage.
* @param locale The current locale
*/
public abstract async write(locale: L10nLocale): Promise&lt;void&gt;;
public abstract write(locale: L10nLocale): Promise&lt;void&gt;;

}

Expand Down
2 changes: 1 addition & 1 deletion docs/injectables/L10nDefaultUserLanguage.html
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ <h3 id="methods">
* This method must contain the logic to get the user language.
* @return The user language
*/
public abstract async get(): Promise&lt;string | null&gt;;
public abstract get(): Promise&lt;string | null&gt;;

}

Expand Down
4 changes: 1 addition & 3 deletions docs/injectables/L10nLoader.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ <h6><b>Methods</b></h6>
<li>
<span class="modifier">Public</span>
<span class="modifier">Abstract</span>
<span class="modifier">Async</span>
<a href="#init">init</a>
</li>
</ul>
Expand Down Expand Up @@ -115,7 +114,6 @@ <h3 id="methods">
<b>
<span class="modifier">Public</span>
<span class="modifier">Abstract</span>
<span class="modifier">Async</span>
init
</b>
<a href="#init"><span class="icon ion-ios-link"></span></a>
Expand Down Expand Up @@ -170,7 +168,7 @@ <h3 id="methods">
/**
* This method must contain the logic to init L10n.
*/
public abstract async init(): Promise&lt;void&gt;;
public abstract init(): Promise&lt;void&gt;;

}

Expand Down
27 changes: 22 additions & 5 deletions docs/injectables/L10nMissingTranslationHandler.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,15 @@ <h3 id="methods">
<tr>
<td class="col-md-4">
<span class="modifier-icon icon ion-ios-reset"></span>
<code>handle(key: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>, value?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>)</code>
<code>handle(key: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>, value?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>, params?: <a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank">any</a>)</code>
</td>
</tr>


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

Expand Down Expand Up @@ -185,6 +185,22 @@ <h3 id="methods">

</td>
</tr>
<tr>
<td>params</td>
<td>
<code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >any</a></code>
</td>

<td>
Yes
</td>


<td>
<p>Optional parameters contained in the key</p>

</td>
</tr>
</tbody>
</table>
</div>
Expand Down Expand Up @@ -219,15 +235,16 @@ <h3 id="methods">
* This method must contain the logic to handle missing values.
* @param key The key that has been requested
* @param value Null or empty string
* @param params Optional parameters contained in the key
* @return The value
*/
public abstract handle(key: string, value?: string): string | any;
public abstract handle(key: string, value?: string, params?: any): string | any;

}

@Injectable() export class L10nDefaultMissingTranslationHandler implements L10nMissingTranslationHandler {

public handle(key: string, value?: string): string | any {
public handle(key: string, value?: string, params?: any): string | any {
return key;
}

Expand Down
2 changes: 1 addition & 1 deletion docs/injectables/L10nRoutingLoader.html
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ <h3 id="methods">
/**
* This method must contain the logic to init L10n.
*/
public abstract async init(): Promise&lt;void&gt;;
public abstract init(): Promise&lt;void&gt;;

}

Expand Down
8 changes: 2 additions & 6 deletions docs/injectables/L10nStorage.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,11 @@ <h6><b>Methods</b></h6>
<li>
<span class="modifier">Public</span>
<span class="modifier">Abstract</span>
<span class="modifier">Async</span>
<a href="#read">read</a>
</li>
<li>
<span class="modifier">Public</span>
<span class="modifier">Abstract</span>
<span class="modifier">Async</span>
<a href="#write">write</a>
</li>
</ul>
Expand Down Expand Up @@ -121,7 +119,6 @@ <h3 id="methods">
<b>
<span class="modifier">Public</span>
<span class="modifier">Abstract</span>
<span class="modifier">Async</span>
read
</b>
<a href="#read"><span class="icon ion-ios-link"></span></a>
Expand Down Expand Up @@ -172,7 +169,6 @@ <h3 id="methods">
<b>
<span class="modifier">Public</span>
<span class="modifier">Abstract</span>
<span class="modifier">Async</span>
write
</b>
<a href="#write"><span class="icon ion-ios-link"></span></a>
Expand Down Expand Up @@ -263,13 +259,13 @@ <h3 id="methods">
* This method must contain the logic to read the storage.
* @return A promise with the value of the locale
*/
public abstract async read(): Promise&lt;L10nLocale | null&gt;;
public abstract read(): Promise&lt;L10nLocale | null&gt;;

/**
* This method must contain the logic to write the storage.
* @param locale The current locale
*/
public abstract async write(locale: L10nLocale): Promise&lt;void&gt;;
public abstract write(locale: L10nLocale): Promise&lt;void&gt;;

}

Expand Down
2 changes: 1 addition & 1 deletion docs/injectables/L10nTranslationService.html
Original file line number Diff line number Diff line change
Expand Up @@ -1542,7 +1542,7 @@ <h3 id="inputs">

const value &#x3D; getValue(keys, this.data[language], this.config.keySeparator);

return value ? this.translationHandler.parseValue(keys, params, value) : this.missingTranslationHandler.handle(keys, value);
return value ? this.translationHandler.parseValue(keys, params, value) : this.missingTranslationHandler.handle(keys, value, params);
}

/**
Expand Down
4 changes: 1 addition & 3 deletions docs/injectables/L10nUserLanguage.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ <h6><b>Methods</b></h6>
<li>
<span class="modifier">Public</span>
<span class="modifier">Abstract</span>
<span class="modifier">Async</span>
<a href="#get">get</a>
</li>
</ul>
Expand Down Expand Up @@ -115,7 +114,6 @@ <h3 id="methods">
<b>
<span class="modifier">Public</span>
<span class="modifier">Abstract</span>
<span class="modifier">Async</span>
get
</b>
<a href="#get"><span class="icon ion-ios-link"></span></a>
Expand Down Expand Up @@ -177,7 +175,7 @@ <h3 id="methods">
* This method must contain the logic to get the user language.
* @return The user language
*/
public abstract async get(): Promise&lt;string | null&gt;;
public abstract get(): Promise&lt;string | null&gt;;

}

Expand Down
4 changes: 2 additions & 2 deletions docs/js/search/search_index.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/modules/L10nIntlModule.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@
<title>cluster_L10nIntlModule</title>
<polygon fill="none" stroke="black" stroke-dasharray="1,5" points="8,-70 8,-268 2214,-268 2214,-70 8,-70"/>
</g>
<g id="clust2" class="cluster">
<title>cluster_L10nIntlModule_declarations</title>
<polygon fill="none" stroke="black" points="188,-78 188,-130 2206,-130 2206,-78 188,-78"/>
</g>
<g id="clust17" class="cluster">
<title>cluster_L10nIntlModule_exports</title>
<polygon fill="none" stroke="black" points="82,-208 82,-260 2143,-260 2143,-208 82,-208"/>
</g>
<g id="clust2" class="cluster">
<title>cluster_L10nIntlModule_declarations</title>
<polygon fill="none" stroke="black" points="188,-78 188,-130 2206,-130 2206,-78 188,-78"/>
</g>
<g id="clust19" class="cluster">
<title>cluster_L10nIntlModule_providers</title>
<polygon fill="none" stroke="black" points="16,-78 16,-130 180,-130 180,-78 16,-78"/>
Expand Down
8 changes: 4 additions & 4 deletions docs/modules/L10nIntlModule/dependencies.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions docs/modules/L10nTranslationModule.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@
<title>cluster_L10nTranslationModule</title>
<polygon fill="none" stroke="black" stroke-dasharray="1,5" points="8,-70 8,-268 518,-268 518,-70 8,-70"/>
</g>
<g id="clust7" class="cluster">
<title>cluster_L10nTranslationModule_exports</title>
<polygon fill="none" stroke="black" points="16,-208 16,-260 510,-260 510,-208 16,-208"/>
</g>
<g id="clust2" class="cluster">
<title>cluster_L10nTranslationModule_declarations</title>
<polygon fill="none" stroke="black" points="22,-78 22,-130 504,-130 504,-78 22,-78"/>
</g>
<g id="clust7" class="cluster">
<title>cluster_L10nTranslationModule_exports</title>
<polygon fill="none" stroke="black" points="16,-208 16,-260 510,-260 510,-208 16,-208"/>
</g>
<!-- L10nTranslateAsyncPipe -->
<g id="node1" class="node">
<title>L10nTranslateAsyncPipe</title>
Expand Down
8 changes: 4 additions & 4 deletions docs/modules/L10nTranslationModule/dependencies.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 2d52c42

Please sign in to comment.