-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
170 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<script lang="ts"> | ||
import CodeBlock from '$lib/components/ui/CodeBlock.svelte'; | ||
import Grid from '$lib/components/ui/Grid.svelte'; | ||
import Input from '$lib/components/ui/Input.svelte'; | ||
import HighlightValue from '$lib/components/ui/HighlightValue.svelte'; | ||
import OptionSection from '$lib/components/ui/OptionSection.svelte'; | ||
import PageLayout from '$lib/components/pages/PageLayout.svelte'; | ||
import { getMessages } from '$lib/i18n/util'; | ||
import type { BrowserSupportDataForMethod } from '$lib/types/BrowserSupport.types'; | ||
export let browserCompatData: BrowserSupportDataForMethod | null; | ||
const fallback = 'ja-Jpan-JP-u-ca-japanese-hc-h12-kf-upper'; | ||
let locale = fallback; | ||
const getIntl = (language: string) => { | ||
try { | ||
return new Intl.Locale(language); | ||
} catch (error) { | ||
return new Intl.Locale(fallback); | ||
} | ||
}; | ||
$: intl = getIntl(locale); | ||
const m = getMessages(); | ||
const properties: (keyof Intl.LocaleOptions)[] = [ | ||
'baseName', | ||
'calendar', | ||
'region', | ||
'script', | ||
'caseFirst', | ||
'collation', | ||
'hourCycle', | ||
'language', | ||
'numberingSystem', | ||
'numeric' | ||
]; | ||
</script> | ||
|
||
<PageLayout showLocalePicker={false}> | ||
<Input id="locale" label={m.locale()} slot="input" bind:value={locale} fullWidth /> | ||
<Grid slot="output"> | ||
{#if intl} | ||
{#each properties as property} | ||
<OptionSection | ||
header={property} | ||
support={browserCompatData?.propertiesSupport?.[property]} | ||
hideFullSupport | ||
> | ||
<CodeBlock> | ||
<HighlightValue value={intl[property] ?? m.noValue()} /> | ||
</CodeBlock> | ||
</OptionSection> | ||
{/each} | ||
{/if} | ||
</Grid> | ||
</PageLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import type { BrowserSupportDataForMethod } from '$lib/types/BrowserSupport.types'; | ||
import type { ServerLoadEvent } from '@sveltejs/kit'; | ||
import { loadJson } from '$lib/utils/load-json'; | ||
|
||
export async function load(loadEvent: ServerLoadEvent): Promise<BrowserSupportDataForMethod> { | ||
return loadJson(loadEvent); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<script lang="ts"> | ||
import Locale from "$lib/components/pages/Locale.svelte"; | ||
import BrowserSupport from "$lib/components/ui/BrowserSupport/BrowserSupport.svelte"; | ||
import Spacing from "$lib/components/ui/Spacing.svelte"; | ||
import { settings } from "$lib/store/settings"; | ||
import type { PageData } from './$types'; | ||
export let data: PageData; | ||
let browserCompatData = $settings.showBrowserSupport ? data : null; | ||
</script> | ||
|
||
{#if $settings.showBrowserSupport} | ||
<BrowserSupport {data} /> | ||
<Spacing /> | ||
{/if} | ||
|
||
<Locale {browserCompatData} /> | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.