This file contains hidden or 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
(import (rnrs (6))) | |
(use-modules ((rnrs) :version (6))) | |
(define (sign number) | |
(cond | |
((< number 0) 'negative) | |
((= number 0) 'zero) | |
(else 'positive)) | |
) |
This file contains hidden or 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
(import (rnrs (6))) | |
(use-modules ((rnrs) :version (6))) | |
(define (leap-year? year) | |
(if (and (divisible? year 4) (not (divisible? year 100))) | |
#t | |
(if (divisible? year 400) | |
#t | |
#f))) |
This file contains hidden or 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
$ npm install -g gatsby-cli | |
# create a new Gatsby site using the default starter | |
$ gatsby new i18n-starter | |
$ cd i18n-starter |
This file contains hidden or 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
$ tree -L 3 . | |
. | |
├── LICENSE | |
├── README.md | |
├── gatsby-browser.js | |
├── gatsby-config.js | |
├── gatsby-node.js | |
├── gatsby-ssr.js | |
├── package-lock.json | |
├── package.json |
This file contains hidden or 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
$ npm install @wapps/gatsby-plugin-i18next react-i18next gatsby-source-filesystem |
This file contains hidden or 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
module.exports = { | |
pathPrefix: '/gatsby-i18n/gatsby-starter-i18next', | |
plugins: [ | |
'gatsby-plugin-react-helmet', | |
{ | |
resolve: `gatsby-plugin-manifest`, | |
options: { | |
name: 'gatsby-starter-lingui', | |
short_name: 'starter', | |
start_url: '/gatsby-i18n/gatsby-starter-i18next/', |
This file contains hidden or 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
import React from 'react'; | |
import PropTypes from 'prop-types'; | |
import { withTranslation } from 'react-i18next'; | |
import { Head } from '@wapps/gatsby-plugin-i18next'; | |
import Header from './header'; | |
import './layout.css'; | |
const Layout = ({ children, data, t }) => ( | |
<> |
This file contains hidden or 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
import React from 'react'; | |
import { Link } from '@wapps/gatsby-plugin-i18next'; | |
import LanguageSwitcher from './languageSwitcher'; | |
const Header = ({ siteTitle }) => ( | |
<div | |
style={{ | |
background: 'blue', | |
marginBottom: '1.45rem', |
This file contains hidden or 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
import React from 'react'; | |
import { Language } from '@wapps/gatsby-plugin-i18next'; | |
const LanguageSwitcher = ({ changeLng, lng, availableLngs }) => ( | |
<select onChange={(e) => changeLng(e.target.value)}> | |
{ | |
availableLngs.map((value) => ( | |
<option key={value} selected={lng === value}>{value}</option> | |
)) | |
}; |
This file contains hidden or 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
➜ tree -L 3 locale | |
locale | |
├── el | |
│ └── messages.json | |
└── en | |
└── messages.json | |
2 directories, 2 files |