ForgeKomponenty
pl

Komponenty

j-Locale

jComponent 20 · jcomponent@20 component Przykład załadowany z jComponent 20

Ten element ustawia aktualny lokal przeglądarki (format numerowy, format daty i format czasu) zgodnie z navigatior.language.

  • Singleton
  • path będzie zawierał aktualny lokalny przeglądarkę
  • Zestaw DEF.dateformat i tworzy wartość środowiskową o nazwie [ts]

Konfiguracja:

  • language {String} opcjonalny, wybrany język (default: navigator.language)
  • requests {Boolean} opcjonalny, dodaje język do każdego żądania (wpływuje na DEF.languagehtml, domyślnie: false)

Środowisko:

  • [ts] pełny czas
  • [date] tylko daty
  • [time] tylko czas

Wyjście:

{
	dt: 'yyyy–MM–dd', // date format
	nf: 1,  // number format: 1 = 100 000.123, 2 = 100 000,123, 3 = 100.000,123, 4 = 100,000.123
	fdw: 0, // first day of week
	tf: 24  // time format: 12, 24
}

Metody:

  • component.use(language)

Wspierane języki specjalne:

  • eu z dd.MM.yyyy z systemem 24 godzin
  • us z MM-dd-yyy z systemem 12 godzin

Użyj go z <ui-component name="locale">Gdy element nie jest jeszcze ładowany, jComponent Pobierz go po pierwszym użyciu z adresu DEF.fallback (Wydaje się Componentator Autor: Peter Širka Źródło: Componentator Zestaw składników, licencja MIT.

example.html
<ui-component name="locale" path="mylocale"></ui-component>
<hr />
<pre><ui-bind path="mylocale" config="text:JSON.stringify(value, null, '  ')"></ui-bind></pre>
<ui-bind path="testvalue" config="template" class="mt10 block">
	<script type="text/html">
		<div>{{ value.date | format }}</div>
		<div>{{ value.date | format('[ts]') }}</div>
		<div>{{ value.number | format(2) }}</div>
	</script>
</ui-bind>

<script>
	var testvalue = { date: new Date(), number: 1234567.89 };
</script>