Skip to content

Commit

Permalink
i18n tweaks + using hex code instead of base16 color name on color label
Browse files Browse the repository at this point in the history
Signed-off-by: lucasew <[email protected]>
  • Loading branch information
lucasew committed Aug 7, 2022
1 parent 74ff6ac commit d6b510e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
8 changes: 0 additions & 8 deletions src/Model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,4 @@ export interface Theme {
};
}

export type i18Led = Record<string, string> | string;

export function i18nGet(txt: i18Led) {
const locale =
navigator.language || (navigator as any).userLanguage || "default";
return txt[locale.replaceAll("-", "_")] || txt;
}

export type Maybe<T> = T | null;
3 changes: 2 additions & 1 deletion src/components/ThemeCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class="theme-card-color-container"
style="background-color: #{theme.colors[color]}"
>
<p>{color}</p>
<p>#{theme.colors[color]}</p>
</div>
{/each}
</div>
Expand Down Expand Up @@ -58,5 +58,6 @@
border-radius: 0.05rem;
margin: 0.5rem;
font-family: "Courier New", monospace;
text-transform: uppercase;
}
</style>
10 changes: 8 additions & 2 deletions src/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { i18Led } from "./Model";

let i18n: Record<string, i18Led> = {
loading: {
en_US: "Loading...",
Expand All @@ -15,4 +13,12 @@ let i18n: Record<string, i18Led> = {
},
};

export type i18Led = Record<string, string> | string;

export function i18nGet(txt: i18Led) {
const locale =
navigator.language || (navigator as any).userLanguage || "default";
return txt[locale.replaceAll("-", "_")] || txt;
}

export default i18n;

1 comment on commit d6b510e

@vercel
Copy link

@vercel vercel bot commented on d6b510e Aug 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

base16-showcase – ./

base16-showcase-lucasew.vercel.app
base16-showcase.vercel.app
base16-showcase-git-main-lucasew.vercel.app

Please sign in to comment.