Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
robisim74 committed Jul 29, 2020
1 parent 3f176d4 commit bb6328e
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 37 deletions.
34 changes: 30 additions & 4 deletions docs/directives/L10nDateDirective.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ <h6><b>Inputs</b></h6>
<li>
<a href="#options">options</a>
</li>
<li>
<a href="#timezone">timezone</a>
</li>
</ul>
</td>
</tr>
Expand Down Expand Up @@ -146,7 +149,7 @@ <h3 id="constructor">Constructor</h3>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="16" class="link-to-prism">projects/angular-l10n/src/lib/directives/l10n-date.directive.ts:16</a></div>
<div class="io-line">Defined in <a href="" data-line="18" class="link-to-prism">projects/angular-l10n/src/lib/directives/l10n-date.directive.ts:18</a></div>
</td>
</tr>

Expand Down Expand Up @@ -264,6 +267,27 @@ <h3 id="inputs">Inputs</h3>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="timezone"></a>
<b>timezone</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>

</td>
</tr>
<tr>
<td class="col-md-2" colspan="2">
<div class="io-line">Defined in <a href="" data-line="18" class="link-to-prism">projects/angular-l10n/src/lib/directives/l10n-date.directive.ts:18</a></div>
</td>
</tr>
</tbody>
</table>
</section>


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

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="27"
class="link-to-prism">projects/angular-l10n/src/lib/directives/l10n-date.directive.ts:27</a></div>
<div class="io-line">Defined in <a href="" data-line="29"
class="link-to-prism">projects/angular-l10n/src/lib/directives/l10n-date.directive.ts:29</a></div>
</td>
</tr>

Expand Down Expand Up @@ -433,6 +457,8 @@ <h3 id="accessors">

@Input() public options: any;

@Input() public timezone: string;

constructor(
protected el: ElementRef,
protected renderer: Renderer2,
Expand All @@ -443,7 +469,7 @@ <h3 id="accessors">
}

protected getValue(text: string): string {
return this.intl.formatDate(text, this.options, this.language);
return this.intl.formatDate(text, this.options, this.language, this.timezone);
}

}
Expand Down
34 changes: 30 additions & 4 deletions docs/directives/L10nNumberDirective.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ <h6><b>Inputs</b></h6>
<tr>
<td class="col-md-4">
<ul class="index-list">
<li>
<a href="#currency">currency</a>
</li>
<li>
<a href="#l10nNumber">l10nNumber</a>
</li>
Expand Down Expand Up @@ -146,7 +149,7 @@ <h3 id="constructor">Constructor</h3>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="16" class="link-to-prism">projects/angular-l10n/src/lib/directives/l10n-number.directive.ts:16</a></div>
<div class="io-line">Defined in <a href="" data-line="18" class="link-to-prism">projects/angular-l10n/src/lib/directives/l10n-number.directive.ts:18</a></div>
</td>
</tr>

Expand Down Expand Up @@ -222,6 +225,27 @@ <h3 id="constructor">Constructor</h3>

<section>
<h3 id="inputs">Inputs</h3>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="currency"></a>
<b>currency</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>

</td>
</tr>
<tr>
<td class="col-md-2" colspan="2">
<div class="io-line">Defined in <a href="" data-line="18" class="link-to-prism">projects/angular-l10n/src/lib/directives/l10n-number.directive.ts:18</a></div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
Expand Down Expand Up @@ -297,8 +321,8 @@ <h3 id="methods">

<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="27"
class="link-to-prism">projects/angular-l10n/src/lib/directives/l10n-number.directive.ts:27</a></div>
<div class="io-line">Defined in <a href="" data-line="29"
class="link-to-prism">projects/angular-l10n/src/lib/directives/l10n-number.directive.ts:29</a></div>
</td>
</tr>

Expand Down Expand Up @@ -433,6 +457,8 @@ <h3 id="accessors">

@Input() public options: any;

@Input() public currency: string;

constructor(
protected el: ElementRef,
protected renderer: Renderer2,
Expand All @@ -443,7 +469,7 @@ <h3 id="accessors">
}

protected getValue(text: string): string {
return this.intl.formatNumber(text, this.options, this.language);
return this.intl.formatNumber(text, this.options, this.language, this.currency);
}

}
Expand Down
2 changes: 2 additions & 0 deletions docs/guards/L10nResolver.html
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ <h3 id="methods">
constructor(private translation: L10nTranslationService) { }

async resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise&lt;void&gt; {
// Initial navigation.
await this.translation.init();
await this.translation.loadTranslation(route.data.l10nProviders);
}
}
Expand Down
30 changes: 13 additions & 17 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="188"
class="link-to-prism">projects/angular-l10n/src/lib/services/l10n-translation.service.ts:188</a></div>
<div class="io-line">Defined in <a href="" data-line="184"
class="link-to-prism">projects/angular-l10n/src/lib/services/l10n-translation.service.ts:184</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="194"
class="link-to-prism">projects/angular-l10n/src/lib/services/l10n-translation.service.ts:194</a></div>
<div class="io-line">Defined in <a href="" data-line="190"
class="link-to-prism">projects/angular-l10n/src/lib/services/l10n-translation.service.ts:190</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="216"
class="link-to-prism">projects/angular-l10n/src/lib/services/l10n-translation.service.ts:216</a></div>
<div class="io-line">Defined in <a href="" data-line="212"
class="link-to-prism">projects/angular-l10n/src/lib/services/l10n-translation.service.ts:212</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="156"
class="link-to-prism">projects/angular-l10n/src/lib/services/l10n-translation.service.ts:156</a></div>
<div class="io-line">Defined in <a href="" data-line="154"
class="link-to-prism">projects/angular-l10n/src/lib/services/l10n-translation.service.ts:154</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="220"
class="link-to-prism">projects/angular-l10n/src/lib/services/l10n-translation.service.ts:220</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 @@ -1562,13 +1562,11 @@ <h3 id="inputs">
* Should only be called when the service instance is created.
*/
public async init(): Promise&lt;void&gt; {
// Checks whether the L10nRoutingService has already initialized the locale.
let locale: L10nLocale | null &#x3D; this.locale.language ? this.locale : null;
// Checks if the service has already been initialized.
if (this.locale.language &amp;&amp; Object.keys(this.data).length &gt; 0) return Promise.resolve();

// Tries to get the locale from the storage.
if (locale &#x3D;&#x3D; null) {
locale &#x3D; await this.storage.read();
}
let 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 Expand Up @@ -1603,8 +1601,6 @@ <h3 id="inputs">

const language &#x3D; formatLanguage(locale.language, this.config.format);

if (language &#x3D;&#x3D; null || language &#x3D;&#x3D;&#x3D; &#x27;&#x27;) return Promise.resolve();

return new Promise((resolve) &#x3D;&gt; {
concat(...this.getTranslation(providers, language)).subscribe({
next: (data) &#x3D;&gt; this.addData(data, language),
Expand Down
4 changes: 2 additions & 2 deletions docs/js/search/search_index.js

Large diffs are not rendered by default.

18 changes: 15 additions & 3 deletions docs/pipes/L10nDateAsyncPipe.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ <h3 id="methods">
<tr>
<td class="col-md-4">
<span class="modifier-icon icon ion-ios-reset"></span>
<code>transform(value: <a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank">any</a>, options?: <a href="../interfaces/L10nDateTimeFormatOptions.html">L10nDateTimeFormatOptions</a>, language?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>)</code>
<code>transform(value: <a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank">any</a>, options?: <a href="../interfaces/L10nDateTimeFormatOptions.html">L10nDateTimeFormatOptions</a>, language?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>, timezone?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>)</code>
</td>
</tr>

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


</tr>
<tr>
<td>timezone</td>
<td>
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
</td>

<td>
Yes
</td>


</tr>
</tbody>
</table>
Expand Down Expand Up @@ -217,10 +229,10 @@ <h3 id="methods">
super(translation, cdr);
}

public transform(value: any, options?: L10nDateTimeFormatOptions, language?: string): string | null {
public transform(value: any, options?: L10nDateTimeFormatOptions, language?: string, timezone?: string): string | null {
if (value &#x3D;&#x3D; null || value &#x3D;&#x3D;&#x3D; &#x27;&#x27;) return null;

return this.intl.formatDate(value, options, language);
return this.intl.formatDate(value, options, language, timezone);
}

}
Expand Down
4 changes: 2 additions & 2 deletions docs/pipes/L10nDatePipe.html
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,10 @@ <h3 id="methods">
super(translation, cdr);
}

public transform(value: any, options?: L10nDateTimeFormatOptions, language?: string): string | null {
public transform(value: any, options?: L10nDateTimeFormatOptions, language?: string, timezone?: string): string | null {
if (value &#x3D;&#x3D; null || value &#x3D;&#x3D;&#x3D; &#x27;&#x27;) return null;

return this.intl.formatDate(value, options, language);
return this.intl.formatDate(value, options, language, timezone);
}

}
Expand Down
18 changes: 15 additions & 3 deletions docs/pipes/L10nNumberAsyncPipe.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ <h3 id="methods">
<tr>
<td class="col-md-4">
<span class="modifier-icon icon ion-ios-reset"></span>
<code>transform(value: <a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank">any</a>, options?: <a href="../interfaces/L10nNumberFormatOptions.html">L10nNumberFormatOptions</a>, language?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>)</code>
<code>transform(value: <a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank">any</a>, options?: <a href="../interfaces/L10nNumberFormatOptions.html">L10nNumberFormatOptions</a>, language?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>, currency?: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>)</code>
</td>
</tr>

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


</tr>
<tr>
<td>currency</td>
<td>
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
</td>

<td>
Yes
</td>


</tr>
</tbody>
</table>
Expand Down Expand Up @@ -217,10 +229,10 @@ <h3 id="methods">
super(translation, cdr);
}

public transform(value: any, options?: L10nNumberFormatOptions, language?: string): string | null {
public transform(value: any, options?: L10nNumberFormatOptions, language?: string, currency?: string): string | null {
if (value &#x3D;&#x3D; null || value &#x3D;&#x3D;&#x3D; &#x27;&#x27;) return null;

return this.intl.formatNumber(value, options, language);
return this.intl.formatNumber(value, options, language, currency);
}

}
Expand Down
4 changes: 2 additions & 2 deletions docs/pipes/L10nNumberPipe.html
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,10 @@ <h3 id="methods">
super(translation, cdr);
}

public transform(value: any, options?: L10nNumberFormatOptions, language?: string): string | null {
public transform(value: any, options?: L10nNumberFormatOptions, language?: string, currency?: string): string | null {
if (value &#x3D;&#x3D; null || value &#x3D;&#x3D;&#x3D; &#x27;&#x27;) return null;

return this.intl.formatNumber(value, options, language);
return this.intl.formatNumber(value, options, language, currency);
}

}
Expand Down

0 comments on commit bb6328e

Please sign in to comment.