diff --git a/.eslintignore b/.eslintignore index f80a26aab2f5..c3ce2733c73a 100644 --- a/.eslintignore +++ b/.eslintignore @@ -8,5 +8,6 @@ types/** website/build website/node_modules website/core/metadata*.js +website/i18n/*.js website/src/jest/docs website/src/jest/blog diff --git a/.gitignore b/.gitignore index 28fc80eb45c5..9c202d2dfe60 100644 --- a/.gitignore +++ b/.gitignore @@ -4,10 +4,13 @@ *~ /danger/node_modules/ /examples/*/node_modules/ + /integration_tests/*/node_modules /integration_tests/transform/*/coverage /integration_tests/transform/*/node_modules + /node_modules + /packages/*/build/ /packages/*/coverage/ /packages/*/node_modules/ @@ -17,6 +20,47 @@ /website/src/jest/blog /website/src/jest/docs /website/yarn.lock + +/website/i18n/* +!/website/i18n/en.json + +/website/af +/website/ar +/website/ca +/website/cs +/website/da +/website/de +/website/el +/website/es-ES +/website/fa-IR +/website/fi +/website/fr +/website/he +/website/hu +/website/id-ID +/website/it +/website/ja +/website/ko +/website/mr-IN +/website/nl +/website/no-NO +/website/pl +/website/pt-BR +/website/pt-PT +/website/ro +/website/ru +/website/sk-SK +/website/sr +/website/sv-SE +/website/tr +/website/uk +/website/vi +/website/zh-Hans +/website/zh-Hant + +/docs/* +!/docs/en + coverage lerna-debug.log npm-debug.log diff --git a/README.md b/README.md index a2721e34304e..c69db4141edd 100644 --- a/README.md +++ b/README.md @@ -42,8 +42,10 @@ test('adds 1 + 2 to equal 3', () => { Add the following section to your `package.json`: ```json -"scripts": { - "test": "jest" +{ + "scripts": { + "test": "jest" + } } ``` diff --git a/circle.yml b/circle.yml index d23724c66cd1..7ca8fdbb1071 100644 --- a/circle.yml +++ b/circle.yml @@ -42,4 +42,11 @@ deployment: - git config --global user.email "jest-bot@users.noreply.github.com" - git config --global user.name "Website Deployment Script" - echo "machine github.com login jest-bot password $GITHUB_TOKEN" > ~/.netrc + # WEBSITE DEPLOY + - sudo apt-get install default-jre + - wget https://artifacts.crowdin.com/repo/deb/crowdin.deb -O crowdin.deb + - sudo dpkg -i crowdin.deb + # crowdin install end + - crowdin --config crowdin.yaml upload sources --auto-update -b master + - crowdin --config crowdin.yaml download -b master - cd website && GIT_USER=jest-bot npm run gh-pages diff --git a/crowdin.yaml b/crowdin.yaml new file mode 100644 index 000000000000..e04e9fe00a0b --- /dev/null +++ b/crowdin.yaml @@ -0,0 +1,48 @@ +project_identifier_env: CROWDIN_PROJECT_ID +api_key_env: CROWDIN_API_KEY +base_path: "./" + +files: + - + source: '/docs/en/*.md' + translation: '/docs/%locale%/%original_file_name%' + languages_mapping: &anchor + locale: + 'af': 'af' + 'ar': 'ar' + 'bs-BA': 'bs-BA' + 'ca': 'ca' + 'cs': 'cs' + 'da': 'da' + 'de': 'de' + 'el': 'el' + 'es-ES': 'es-ES' + 'fa': 'fa-IR' + 'fi': 'fi' + 'fr': 'fr' + 'he': 'he' + 'hu': 'hu' + 'id': 'id-ID' + 'it': 'it' + 'ja': 'ja' + 'ko': 'ko' + 'mr': 'mr-IN' + 'nl': 'nl' + 'no': 'no-NO' + 'pl': 'pl' + 'pt-BR': 'pt-BR' + 'pt-PT': 'pt-PT' + 'ro': 'ro' + 'ru': 'ru' + 'sk': 'sk-SK' + 'sr': 'sr' + 'sv-SE': 'sv-SE' + 'tr': 'tr' + 'uk': 'uk' + 'vi': 'vi' + 'zh-CN': 'zh-Hans' + 'zh-TW': 'zh-Hant' + - + source: '/website/i18n/en.json' + translation: '/website/i18n/%locale%.json' + languages_mapping: *anchor diff --git a/docs/CLI.md b/docs/en/CLI.md similarity index 99% rename from docs/CLI.md rename to docs/en/CLI.md index 802c4ef85138..ac04bcf3a26d 100644 --- a/docs/CLI.md +++ b/docs/en/CLI.md @@ -1,9 +1,9 @@ --- id: cli title: Jest CLI Options -layout: reference +layout: docs category: API Reference -permalink: docs/cli.html +permalink: docs/en/cli.html previous: configuration --- diff --git a/docs/Configuration.md b/docs/en/Configuration.md similarity index 99% rename from docs/Configuration.md rename to docs/en/Configuration.md index c4a4ab2f2b43..5db743a1782f 100644 --- a/docs/Configuration.md +++ b/docs/en/Configuration.md @@ -1,9 +1,9 @@ --- id: configuration title: Configuring package.json -layout: reference +layout: docs category: API Reference -permalink: docs/configuration.html +permalink: docs/en/configuration.html previous: jest-object next: cli --- diff --git a/docs/ExpectAPI.md b/docs/en/ExpectAPI.md similarity index 99% rename from docs/ExpectAPI.md rename to docs/en/ExpectAPI.md index aa7b28b4809c..af6605c9b237 100644 --- a/docs/ExpectAPI.md +++ b/docs/en/ExpectAPI.md @@ -1,9 +1,9 @@ --- id: expect title: Expect -layout: reference +layout: docs category: API Reference -permalink: docs/expect.html +permalink: docs/en/expect.html previous: api next: mock-function-api --- diff --git a/docs/GettingStarted.md b/docs/en/GettingStarted.md similarity index 98% rename from docs/GettingStarted.md rename to docs/en/GettingStarted.md index 8b246a3f219b..5c17474e764e 100644 --- a/docs/GettingStarted.md +++ b/docs/en/GettingStarted.md @@ -3,7 +3,7 @@ id: getting-started title: Getting Started layout: docs category: Introduction -permalink: docs/getting-started.html +permalink: docs/en/getting-started.html next: using-matchers --- diff --git a/docs/GlobalAPI.md b/docs/en/GlobalAPI.md similarity index 99% rename from docs/GlobalAPI.md rename to docs/en/GlobalAPI.md index b8c29d910a11..dfd8ea06db75 100644 --- a/docs/GlobalAPI.md +++ b/docs/en/GlobalAPI.md @@ -1,9 +1,9 @@ --- id: api title: Globals -layout: reference +layout: docs category: API Reference -permalink: docs/api.html +permalink: docs/en/api.html next: expect --- diff --git a/docs/JestObjectAPI.md b/docs/en/JestObjectAPI.md similarity index 99% rename from docs/JestObjectAPI.md rename to docs/en/JestObjectAPI.md index 91e8d29d568c..36fc10ff1ab3 100644 --- a/docs/JestObjectAPI.md +++ b/docs/en/JestObjectAPI.md @@ -1,9 +1,9 @@ --- id: jest-object title: The Jest Object -layout: reference +layout: docs category: API Reference -permalink: docs/jest-object.html +permalink: docs/en/jest-object.html previous: mock-function-api next: configuration --- diff --git a/docs/ManualMocks.md b/docs/en/ManualMocks.md similarity index 99% rename from docs/ManualMocks.md rename to docs/en/ManualMocks.md index 8c132d9fae62..ffd06ad6daf4 100644 --- a/docs/ManualMocks.md +++ b/docs/en/ManualMocks.md @@ -3,7 +3,7 @@ id: manual-mocks title: Manual Mocks layout: docs category: Guides -permalink: docs/manual-mocks.html +permalink: docs/en/manual-mocks.html previous: timer-mocks next: webpack --- diff --git a/docs/MigrationGuide.md b/docs/en/MigrationGuide.md similarity index 96% rename from docs/MigrationGuide.md rename to docs/en/MigrationGuide.md index 92cdb5db7047..8bfb7fd9de00 100644 --- a/docs/MigrationGuide.md +++ b/docs/en/MigrationGuide.md @@ -3,7 +3,7 @@ id: migration-guide title: Migrating to Jest layout: docs category: Guides -permalink: docs/migration-guide.html +permalink: docs/en/migration-guide.html previous: webpack next: testing-frameworks --- @@ -30,4 +30,4 @@ To transform your existing tests, navigate to the project containing the tests a jest-codemods ``` -More information can be found at https://github.com/skovhus/jest-codemods. +More information can be found at https://github.com/skovhus/jest-codemods. \ No newline at end of file diff --git a/docs/MockFunctionAPI.md b/docs/en/MockFunctionAPI.md similarity index 98% rename from docs/MockFunctionAPI.md rename to docs/en/MockFunctionAPI.md index 08f7dac3596f..be3adbefbbc7 100644 --- a/docs/MockFunctionAPI.md +++ b/docs/en/MockFunctionAPI.md @@ -1,9 +1,9 @@ --- id: mock-function-api title: Mock Functions -layout: reference +layout: docs category: API Reference -permalink: docs/mock-function-api.html +permalink: docs/en/mock-function-api.html previous: expect next: jest-object --- diff --git a/docs/MockFunctions.md b/docs/en/MockFunctions.md similarity index 99% rename from docs/MockFunctions.md rename to docs/en/MockFunctions.md index 2d6c34bab8c3..ab95f0f13733 100644 --- a/docs/MockFunctions.md +++ b/docs/en/MockFunctions.md @@ -3,7 +3,7 @@ id: mock-functions title: Mock Functions layout: docs category: Introduction -permalink: docs/mock-functions.html +permalink: docs/en/mock-functions.html previous: setup-teardown next: more-resources --- diff --git a/docs/MoreResources.md b/docs/en/MoreResources.md similarity index 97% rename from docs/MoreResources.md rename to docs/en/MoreResources.md index f416fd68d8f0..c6ae3a0ecccb 100644 --- a/docs/MoreResources.md +++ b/docs/en/MoreResources.md @@ -3,7 +3,7 @@ id: more-resources title: More Resources layout: docs category: Introduction -permalink: docs/more-resources.html +permalink: docs/en/more-resources.html previous: mock-functions next: snapshot-testing --- diff --git a/docs/SetupAndTeardown.md b/docs/en/SetupAndTeardown.md similarity index 99% rename from docs/SetupAndTeardown.md rename to docs/en/SetupAndTeardown.md index 847b6aacab0f..27fe603def40 100644 --- a/docs/SetupAndTeardown.md +++ b/docs/en/SetupAndTeardown.md @@ -3,7 +3,7 @@ id: setup-teardown title: Setup and Teardown layout: docs category: Introduction -permalink: docs/setup-teardown.html +permalink: docs/en/setup-teardown.html previous: asynchronous next: mock-functions --- diff --git a/docs/SnapshotTesting.md b/docs/en/SnapshotTesting.md similarity index 99% rename from docs/SnapshotTesting.md rename to docs/en/SnapshotTesting.md index 2f69a74eb101..6a6deba7362f 100644 --- a/docs/SnapshotTesting.md +++ b/docs/en/SnapshotTesting.md @@ -3,7 +3,7 @@ id: snapshot-testing title: Snapshot Testing layout: docs category: Guides -permalink: docs/snapshot-testing.html +permalink: docs/en/snapshot-testing.html next: tutorial-react --- diff --git a/docs/TestingAsyncCode.md b/docs/en/TestingAsyncCode.md similarity index 99% rename from docs/TestingAsyncCode.md rename to docs/en/TestingAsyncCode.md index 574c9f352938..afc686c6f809 100644 --- a/docs/TestingAsyncCode.md +++ b/docs/en/TestingAsyncCode.md @@ -3,7 +3,7 @@ id: asynchronous title: Testing Asynchronous Code layout: docs category: Introduction -permalink: docs/asynchronous.html +permalink: docs/en/asynchronous.html previous: using-matchers next: setup-teardown --- diff --git a/docs/TestingFrameworks.md b/docs/en/TestingFrameworks.md similarity index 100% rename from docs/TestingFrameworks.md rename to docs/en/TestingFrameworks.md diff --git a/docs/TimerMocks.md b/docs/en/TimerMocks.md similarity index 99% rename from docs/TimerMocks.md rename to docs/en/TimerMocks.md index 0a2503fdf8c7..fcd37b9c1add 100644 --- a/docs/TimerMocks.md +++ b/docs/en/TimerMocks.md @@ -3,7 +3,7 @@ id: timer-mocks title: Timer Mocks layout: docs category: Guides -permalink: docs/timer-mocks.html +permalink: docs/en/timer-mocks.html previous: tutorial-async next: manual-mocks --- diff --git a/docs/Troubleshooting.md b/docs/en/Troubleshooting.md similarity index 99% rename from docs/Troubleshooting.md rename to docs/en/Troubleshooting.md index 2a1f9e06120c..272f5c50e345 100644 --- a/docs/Troubleshooting.md +++ b/docs/en/Troubleshooting.md @@ -3,8 +3,10 @@ id: troubleshooting title: Troubleshooting layout: docs category: Guides -permalink: docs/troubleshooting.html +permalink: docs/en/troubleshooting.html previous: testing-frameworks +next: api + --- Uh oh, something went wrong? Use this guide to resolve issues with Jest. diff --git a/docs/TutorialAsync.md b/docs/en/TutorialAsync.md similarity index 99% rename from docs/TutorialAsync.md rename to docs/en/TutorialAsync.md index b491a46f984d..624b16663dd2 100644 --- a/docs/TutorialAsync.md +++ b/docs/en/TutorialAsync.md @@ -3,7 +3,7 @@ id: tutorial-async title: An Async Example layout: docs category: Guides -permalink: docs/tutorial-async.html +permalink: docs/en/tutorial-async.html previous: tutorial-react-native next: timer-mocks --- diff --git a/docs/TutorialReact.md b/docs/en/TutorialReact.md similarity index 99% rename from docs/TutorialReact.md rename to docs/en/TutorialReact.md index 4f09951f3fc0..ff5f26ed23b3 100644 --- a/docs/TutorialReact.md +++ b/docs/en/TutorialReact.md @@ -3,7 +3,7 @@ id: tutorial-react title: Testing React Apps layout: docs category: Guides -permalink: docs/tutorial-react.html +permalink: docs/en/tutorial-react.html previous: snapshot-testing next: tutorial-react-native --- diff --git a/docs/TutorialReactNative.md b/docs/en/TutorialReactNative.md similarity index 99% rename from docs/TutorialReactNative.md rename to docs/en/TutorialReactNative.md index b625613a6ff7..271b9357e62a 100644 --- a/docs/TutorialReactNative.md +++ b/docs/en/TutorialReactNative.md @@ -3,7 +3,7 @@ id: tutorial-react-native title: Testing React Native Apps layout: docs category: Guides -permalink: docs/tutorial-react-native.html +permalink: docs/en/tutorial-react-native.html previous: tutorial-react next: tutorial-async --- diff --git a/docs/TutorialWebpack.md b/docs/en/TutorialWebpack.md similarity index 68% rename from docs/TutorialWebpack.md rename to docs/en/TutorialWebpack.md index d2805bd1a0bf..cea3d96ca494 100644 --- a/docs/TutorialWebpack.md +++ b/docs/en/TutorialWebpack.md @@ -2,6 +2,6 @@ id: tutorial-webpack title: webpack layout: redirect -permalink: docs/tutorial-webpack.html +permalink: docs/en/tutorial-webpack.html destinationUrl: webpack.html --- diff --git a/docs/TutorialjQuery.md b/docs/en/TutorialjQuery.md similarity index 98% rename from docs/TutorialjQuery.md rename to docs/en/TutorialjQuery.md index 72df88a745ac..baacdcfe7dec 100644 --- a/docs/TutorialjQuery.md +++ b/docs/en/TutorialjQuery.md @@ -3,7 +3,7 @@ id: tutorial-jquery title: DOM Manipulation layout: docs category: Guides -permalink: docs/tutorial-jquery.html +permalink: docs/en/tutorial-jquery.html next: mock-functions --- diff --git a/docs/UsingMatchers.md b/docs/en/UsingMatchers.md similarity index 99% rename from docs/UsingMatchers.md rename to docs/en/UsingMatchers.md index 363ccb61455d..90b07fa9ffce 100644 --- a/docs/UsingMatchers.md +++ b/docs/en/UsingMatchers.md @@ -3,7 +3,7 @@ id: using-matchers title: Using Matchers layout: docs category: Introduction -permalink: docs/using-matchers.html +permalink: docs/en/using-matchers.html previous: getting-started next: asynchronous --- diff --git a/docs/Webpack.md b/docs/en/Webpack.md similarity index 99% rename from docs/Webpack.md rename to docs/en/Webpack.md index 0d5093fefc11..fba8df33ef56 100644 --- a/docs/Webpack.md +++ b/docs/en/Webpack.md @@ -3,7 +3,7 @@ id: webpack title: Using with webpack layout: docs category: Guides -permalink: docs/webpack.html +permalink: docs/en/webpack.html previous: manual-mocks next: migration-guide --- diff --git a/website/core/BlogPost.js b/website/core/BlogPost.js index 53be4f17782f..4334b16954ea 100644 --- a/website/core/BlogPost.js +++ b/website/core/BlogPost.js @@ -5,7 +5,7 @@ * @jsx React.DOM */ - /* eslint-disable sort-keys */ +/* eslint-disable sort-keys */ const Marked = require('Marked'); const React = require('React'); @@ -20,8 +20,9 @@ class BlogPost extends React.Component {
{content}
- Read More + + Read More +
); @@ -35,7 +36,13 @@ class BlogPost extends React.Component { return (
- +
); @@ -59,13 +66,24 @@ class BlogPost extends React.Component { // Because JavaScript sucks at date handling :( const year = match[1]; const month = [ - 'January', 'February', 'March', 'April', 'May', 'June', 'July', - 'August', 'September', 'October', 'November', 'December', + 'January', + 'February', + 'March', + 'April', + 'May', + 'June', + 'July', + 'August', + 'September', + 'October', + 'November', + 'December', ][parseInt(match[2], 10) - 1]; const day = parseInt(match[3], 10); - const githubButton = this.props.truncate ? null : -

{siteConfig.githubButton}

; + const githubButton = this.props.truncate + ? null + :

{siteConfig.githubButton}

; return (
diff --git a/website/core/BlogSidebar.js b/website/core/BlogSidebar.js index 5818f24d7b23..15e58b6dbad8 100644 --- a/website/core/BlogSidebar.js +++ b/website/core/BlogSidebar.js @@ -26,6 +26,7 @@ const BlogSidebar = React.createClass({ return ( + Edit this Doc + + ); + if (this.props.language != 'en') { + editLink = ( + + Translate this Doc + + ); + } + return (
- Edit this Doc + {editLink}

{this.props.title}

diff --git a/website/core/DocsSidebar.js b/website/core/DocsSidebar.js index 7581c67fe7ff..fff7619fa490 100644 --- a/website/core/DocsSidebar.js +++ b/website/core/DocsSidebar.js @@ -5,8 +5,7 @@ * @jsx React.DOM */ - /* eslint-disable sort-keys */ - +/* eslint-disable sort-keys */ const Metadata = require('Metadata'); const React = require('React'); @@ -14,9 +13,10 @@ const Container = require('Container'); const SideNav = require('SideNav'); class DocsSidebar extends React.Component { - getCategories() { + getCategories(language) { const metadatas = Metadata.files.filter(metadata => { - return metadata.layout === this.props.layout; + return metadata.layout === this.props.layout && + metadata.language === language; }); // Build a hashmap of article_id -> metadata @@ -33,11 +33,7 @@ class DocsSidebar extends React.Component { if (metadata.next) { if (!articles[metadata.next]) { throw new Error( - '`next: ' + - metadata.next + - '` in ' + - metadata.id + - ' doesn\'t exist' + '`next: ' + metadata.next + '` in ' + metadata.id + " doesn't exist" ); } previous[articles[metadata.next].id] = metadata.id; @@ -79,9 +75,10 @@ class DocsSidebar extends React.Component { return ( @@ -97,7 +94,7 @@ DocsSidebar.propTypes = { DocsSidebar.defaultProps = { layout: 'docs', - root: '/jest/docs/getting-started.html', + root: '/jest/docs/en/getting-started.html', title: 'Docs', }; diff --git a/website/core/Footer.js b/website/core/Footer.js index 4f98f728bbd0..79275fccc3ff 100644 --- a/website/core/Footer.js +++ b/website/core/Footer.js @@ -8,25 +8,54 @@ const siteConfig = require('../siteConfig.js'); class Footer extends React.Component { render() { - const currentYear = (new Date()).getFullYear(); + const currentYear = new Date().getFullYear(); return (