Skip to content

Commit

Permalink
Merge branch 'canary' into update/build-404-export
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Mar 8, 2021
2 parents 26d0a5e + 3f9c469 commit 930b252
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 6 deletions.
6 changes: 6 additions & 0 deletions examples/api-routes-apollo-server-and-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

In this simple example, we integrate Apollo seamlessly with [Next.js data fetching methods](https://nextjs.org/docs/basic-features/data-fetching) to fetch queries in the server and hydrate them in the browser.

## Deploy your own

Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example):

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/api-routes-apollo-server-and-client&project-name=api-routes-apollo-server-and-client&repository-name=api-routes-apollo-server-and-client)

## How to use

Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
Expand Down
2 changes: 1 addition & 1 deletion examples/with-next-translate/i18n.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"locales": ["en", "ca"],
"locales": ["en", "ca", "ar", "he"],
"defaultLocale": "en",
"pages": {
"*": ["common"],
Expand Down
5 changes: 5 additions & 0 deletions examples/with-next-translate/locales/ar/common.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"title": "مثال with-next-translate",
"powered": "Powered by",
"alt": "Vercel logo"
}
14 changes: 14 additions & 0 deletions examples/with-next-translate/locales/ar/home.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"arabic": "العربية",
"catalan": "الكاتالونية",
"change-arabic": "تغيير اللغة إلى العربية ",
"change-catalan": "تغيير اللغة إلى الكتالانية",
"change-english": "تغيير اللغة إلى اللغة الإنجليزية ",
"change-hebrew": "تغيير اللغة إلى العبرية",
"description": "ابدأ بالتعديل",
"english": "الإنجليزية",
"hebrew": "العبرية",
"next-docs": "اعثر على معلومات متعمقة حول ميزات Next.js وواجهة برمجة التطبيقات. ",
"plugin-docs": "اقرأ المزيد عن استخدام الترجمة التالية. ",
"title": "<0>مرحبا بك في <1></1></0>"
}
4 changes: 4 additions & 0 deletions examples/with-next-translate/locales/ca/home.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{
"arabic": "Àrab",
"catalan": "Català",
"change-arabic": "Canvia a la versió en àrab",
"change-catalan": "Canvia a la versió en català",
"change-english": "Canvia a la versió en anglès",
"change-hebrew": "Canvieu a la versió hebrea",
"description": "Comença editant",
"english": "Anglès",
"hebrew": "Hebreu",
"next-docs": "Troba informació detallada sobre l'API de Next.js.",
"plugin-docs": "Llegeix més sobre com fer servir next-translate.",
"title": "<0>Benvingut a <1></1></0>"
Expand Down
4 changes: 4 additions & 0 deletions examples/with-next-translate/locales/en/home.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{
"arabic": "Arabic",
"catalan": "Catalan",
"change-arabic": "Change language to Arabic",
"change-catalan": "Change language to Catalan",
"change-english": "Change language to English",
"change-hebrew": "Change language to Hebrew",
"description": "Get started by editing",
"english": "English",
"hebrew": "Hebrew",
"next-docs": "Find in-depth information about Next.js features and API.",
"plugin-docs": "Read more about next-translation usage.",
"title": "<0>Welcome to <1></1></0>"
Expand Down
5 changes: 5 additions & 0 deletions examples/with-next-translate/locales/he/common.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"title": "דוגמא with-next-translate",
"powered": "Powered by",
"alt": "Vercel logo"
}
14 changes: 14 additions & 0 deletions examples/with-next-translate/locales/he/home.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"arabic": "עֲרָבִית",
"catalan": "קטלאנית",
"change-arabic": "שנה שפה לערבית",
"change-catalan": "שנה שפה לקטלונית",
"change-english": "שנה שפה לאנגלית",
"change-hebrew": "שנה את השפה לעברית",
"description": "התחל על ידי עריכה",
"english": "אנגלית",
"hebrew": "עִברִית",
"next-docs": "מצא מידע מעמיק על התכונות וה- API של Next.js.",
"plugin-docs": "קרא עוד על השימוש בתרגום הבא.",
"title": "<0>ברוך הבא ל <1></1></0>"
}
31 changes: 26 additions & 5 deletions examples/with-next-translate/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import useTranslation from 'next-translate/useTranslation'
import Layout from '../components/Layout'

export default function Home() {
const { t } = useTranslation()
const { t, lang } = useTranslation()
const isRTL = lang === 'ar' || lang === 'he'
const arrow = isRTL ? String.fromCharCode(8592) : String.fromCharCode(8594)

return (
<Layout>
<main>
<main dir={isRTL ? 'rtl' : 'ltr'}>
<Trans
i18nKey="home:title"
components={[
Expand Down Expand Up @@ -36,16 +38,30 @@ export default function Home() {
</div>
</Link>

<Link href="/" locale="ar">
<div className="card">
<h3>{t('home:arabic')}</h3>
<p>{t('home:change-arabic')}</p>
</div>
</Link>

<Link href="/" locale="he">
<div className="card">
<h3>{t('home:hebrew')}</h3>
<p>{t('home:change-hebrew')}</p>
</div>
</Link>

<a href="https://nextjs.org/docs" className="card">
<h3>Next.js &rarr;</h3>
<h3>Next.{`js ${arrow}`}</h3>
<p>{t('home:next-docs')}</p>
</a>

<a
href="https://github.com/vinissimus/next-translate"
className="card"
>
<h3>Learn &rarr;</h3>
<h3>{`Learn ${arrow}`}</h3>
<p>{t('home:plugin-docs')}</p>
</a>
</div>
Expand Down Expand Up @@ -119,8 +135,9 @@ export default function Home() {
}
.card h3 {
margin: 0 0 1rem 0;
display: flex;
font-size: 1.5rem;
margin: 0 0 1rem 0;
}
.card p {
Expand All @@ -129,6 +146,10 @@ export default function Home() {
line-height: 1.5;
}
[dir='rtl'] p {
text-align: right;
}
@media (max-width: 600px) {
.grid {
width: 100%;
Expand Down

0 comments on commit 930b252

Please sign in to comment.