Skip to content

Commit

Permalink
better set i18n, decrease grid margins
Browse files Browse the repository at this point in the history
  • Loading branch information
terrablue committed Jan 24, 2024
1 parent 71d5aae commit f730550
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 10 deletions.
45 changes: 36 additions & 9 deletions docs/examples/i18n.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
%%% React, Svelte, Solid

```jsx caption=components/Index.jsx
import { default as t, locale } from "@primate/i18n/react";
import t from "@primate/i18n/react";
import { locale } from "@primate/i18n/react";

export default function ({ username }) {
return <>
Expand All @@ -12,15 +13,24 @@ export default function ({ username }) {
{t("bye")}~

<h3>{t("switch-language")}</h3>
<div><a onClick={() => locale.set("en-US")}>{t("English")}</a></div>
<div><a onClick={() => locale.set("de-DE")}>{t("German")}</a></div>
<div>
<a onClick={() => locale.set("en-US")}>
{t("English")}
</a>
</div>
<div>
<a onClick={() => locale.set("de-DE")}>
{t("German")}
</a>
</div>
</>;
}
```

```html caption=components/Index.svelte
<script>
import { default as t, locale } from "@primate/i18n/svelte";
import t from "@primate/i18n/svelte";
import { locale } from "@primate/i18n/svelte";
export let username;
</script>
Expand All @@ -31,12 +41,21 @@ export default function ({ username }) {
{$t("bye")}~

<h3>{$t("switch-language")}</h3>
<div><a on:click={() => locale.set("en-US")}>{$t("English")}</a></div>
<div><a on:click={() => locale.set("de-DE")}>{$t("German")}</a></div>
<div>
<a on:click={() => locale.set("en-US")}>
{$t("English")}
</a>
</div>
<div>
<a on:click={() => locale.set("de-DE")}>
{$t("German")}
</a>
</div>
```

```jsx caption=components/Index.jsx
import { default as t, locale } from "@primate/i18n/solid";
import t from "@primate/i18n/solid";
import { locale } from "@primate/i18n/solid";

export default function ({ username }) {
return <>
Expand All @@ -47,8 +66,16 @@ export default function ({ username }) {
{t("bye")}~

<h3>{t("switch-language")}</h3>
<div><a onClick={() => locale.set("en-US")}>{t("English")}</a></div>
<div><a onClick={() => locale.set("de-DE")}>{t("German")}</a></div>
<div>
<a onClick={() => locale.set("en-US")}>
{t("English")}
</a>
</div>
<div>
<a onClick={() => locale.set("de-DE")}>
{t("German")}
</a>
</div>
</>;
}
```
Expand Down
2 changes: 1 addition & 1 deletion packages/website/static/master.css
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ main.hero {
.hero .table {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
padding: 50px 75px;
padding: 50px 30px;
}

.hero .table > div {
Expand Down

0 comments on commit f730550

Please sign in to comment.