Skip to content

Commit

Permalink
[i18nIgnore] Migrate to Content Collections (withastro#2546)
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Swithinbank <[email protected]>
  • Loading branch information
bholmesdev and delucis authored Feb 15, 2023
1 parent 4044666 commit 19fa02f
Show file tree
Hide file tree
Showing 1,136 changed files with 77,823 additions and 78,159 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ dist
node_modules
.github
.changeset
/src/pages/lighthouse
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ module.exports = {
'@typescript-eslint/no-non-null-assertion': 'off',
},
},
{
files: ['*.d.ts'],
rules: {
'@typescript-eslint/triple-slash-reference': 'off',
},
},
{
files: ['*.tsx'],
parser: '@typescript-eslint/parser',
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ runs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
cache: pnpm

- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
- .github/workflows/**

i18n:
- any: ['src/pages/**/*.mdx', '!src/pages/en/**/*']
- any: ['src/content/docs/**/*.mdx', '!src/content/docs/en/**/*']
6 changes: 3 additions & 3 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
with:
branch: ci/docgen-integrations
token: ${{ secrets.FREDKBOT_GITHUB_TOKEN }}
add-paths: src/pages/en/guides/integrations-guide/*.mdx
add-paths: src/content/docs/en/guides/integrations-guide/*.mdx
commit-message: 'ci: update integration docs'
title: 'ci: update integration docs'
body: |
Expand All @@ -55,7 +55,7 @@ jobs:
with:
branch: ci/docgen
token: ${{ secrets.FREDKBOT_GITHUB_TOKEN }}
add-paths: src/pages/en/reference/*.mdx
add-paths: src/content/docs/en/reference/*.mdx
commit-message: 'ci: update reference docs'
title: 'ci: update reference docs'
body: |
Expand All @@ -82,7 +82,7 @@ jobs:
with:
branch: ci/docgen-errors
token: ${{ secrets.FREDKBOT_GITHUB_TOKEN }}
add-paths: src/pages/en/reference/*.mdx
add-paths: src/content/docs/en/reference/*.mdx
commit-message: 'ci: update error reference docs'
title: 'ci: update error reference docs'
body: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# build output
dist
.astro/

# dependencies
node_modules/
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.19.0
18.14.0
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ node_modules
.changeset
*.md
*.mdx
src/pages/lighthouse/*.astro
pnpm-lock.yaml
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Contributions to the documentation site are made by editing the docs repository.
**Internationalization (i18n)**

Please only add new text content to the docs **in English**, by modifying only **`.md` files located within `src/pages/en/`**.
Please only add new text content to the docs **in English**, by modifying only **`.md` files located within `src/content/docs/en/`**.

We have automated systems in place for notifying our community translators that there is new material to be translated, so there is no need to make changes to additional languages yourself.

Expand Down
4 changes: 2 additions & 2 deletions TRANSLATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Each of these content types lives in a different place.

### 1. Documentation pages

Each documentation page lives in the `src/pages` directory of this <abbr title="repository">repo</abbr>. There you’ll find directories for all of the languages currently translated. Each page is a Markdown file to support rich text formatting. For example, the English language “Getting Started” page is at `src/pages/en/getting-started.md` and the same page in French is at `src/pages/fr/getting-started.md`.
Each documentation page lives in the `src/content/docs/` directory of this <abbr title="repository">repo</abbr>. There you’ll find directories for all of the languages currently translated. Each page is a Markdown file to support rich text formatting. For example, the English language “Getting Started” page is at `src/content/docs/en/getting-started.md` and the same page in French is at `src/content/docs/fr/getting-started.md`.

### 2. UI text

Expand Down Expand Up @@ -102,7 +102,7 @@ If you spot something on [docs.astro.build](https://docs.astro.build/) that you

4. Is the text specific to one page (page title, main content, etc.)?

➤ Go to `src/pages/{language}/{page-slug}.md`
➤ Go to `src/content/docs/{language}/{page-slug}.md`

# Contributing to translations

Expand Down
5 changes: 2 additions & 3 deletions astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { defineConfig } from 'astro/config';
import AutoImport from 'astro-auto-import';
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
import rehypeSlug from 'rehype-slug';
import remarkGFM from 'remark-gfm';
import remarkSmartypants from 'remark-smartypants';

import { asideAutoImport, astroAsides } from './integrations/astro-asides';
Expand Down Expand Up @@ -33,9 +32,9 @@ export default defineConfig({
markdown: {
syntaxHighlight: 'shiki',
shikiConfig: { theme },
// Override with our own config
smartypants: false,
remarkPlugins: [
// These are here because setting custom plugins disables the default plugins
remarkGFM,
[remarkSmartypants, { dashes: false }],
// Add our custom plugin that marks links to fallback language pages
remarkFallbackLang(),
Expand Down
18 changes: 8 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"test": "vitest",
"preview": "astro preview",
"check": "astro check",
"tsc": "tsc",
"tsc": "astro sync && tsc",
"format": "pnpm run format:code",
"format:ci": "pnpm run format:imports && pnpm run format:code",
"format:code": "prettier -w . --cache --plugin-search-dir=.",
Expand All @@ -31,23 +31,24 @@
"@11ty/eleventy-fetch": "^3.0.0",
"@actions/core": "^1.9.0",
"@algolia/client-search": "^4.14.2",
"@astrojs/mdx": "^0.14.0",
"@astrojs/preact": "^1.2.0",
"@astrojs/sitemap": "1.0.0",
"@astrojs/mdx": "^0.16.1",
"@astrojs/preact": "^2.0.3",
"@astrojs/sitemap": "1.0.1",
"@babel/core": "^7.18.10",
"@docsearch/css": "^3.2.2",
"@docsearch/react": "^3.2.0",
"@types/canvas-confetti": "^1.6.0",
"@types/chroma-js": "^2.1.4",
"@types/hast": "^2.3.4",
"@types/html-escaper": "^3.0.0",
"@types/mdast": "^3.0.10",
"@types/node": "^18.6.4",
"@typescript-eslint/eslint-plugin": "^5.46.1",
"@typescript-eslint/parser": "^5.46.1",
"astro": "^1.8.0",
"astro-auto-import": "^0.2.0",
"astro": "^2.0.12",
"astro-auto-import": "^0.2.1",
"astro-eslint-parser": "^0.9.2",
"astro-og-canvas": "^0.1.5",
"astro-og-canvas": "^0.1.6",
"bcp-47-normalize": "^2.1.0",
"canvaskit-wasm": "^0.37.0",
"chroma-js": "^2.4.2",
Expand All @@ -57,7 +58,6 @@
"eslint-plugin-astro": "^0.21.0",
"eslint-plugin-react": "^7.32.1",
"fast-glob": "^3.2.11",
"gray-matter": "^4.0.3",
"hast-util-from-html": "^1.0.0",
"hast-util-to-string": "^2.0.0",
"hastscript": "^7.0.2",
Expand All @@ -81,7 +81,6 @@
"remark": "^14.0.2",
"remark-directive": "^2.0.1",
"simple-git": "^3.11.0",
"tiny-glob": "^0.2.9",
"tsm": "^2.2.2",
"typescript": "^4.7.4",
"unified": "^10.1.2",
Expand All @@ -93,7 +92,6 @@
"dependencies": {
"@fontsource/ibm-plex-mono": "^4.5.10",
"@nanostores/preact": "^0.1.3",
"@types/canvas-confetti": "^1.6.0",
"canvas-confetti": "^1.6.0",
"jsdoc-api": "^7.1.1",
"nanostores": "^0.5.13",
Expand Down
2 changes: 1 addition & 1 deletion plugins/rehype-i18n-autolink-headings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { getLanguageCodeFromPathname, mdFilePathToUrl } from './remark-fallback-
* Rehype plugin to translate the headings' anchors according to the currently selected language.
*/
export function rehypei18nAutolinkHeadings() {
const pageSourceDir = path.resolve('./src/pages');
const pageSourceDir = path.resolve('./src/content/docs');
const baseUrl = 'https://docs.astro.build/';

const transformer: Transformer<Root> = (tree, file) => {
Expand Down
2 changes: 1 addition & 1 deletion plugins/remark-fallback-lang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { Plugin, Transformer } from 'unified';
import { visit } from 'unist-util-visit';

export function remarkFallbackLang(): Plugin<[], Root> {
const pageSourceDir = path.resolve('./src/pages');
const pageSourceDir = path.resolve('./src/content/docs');
const baseUrl = 'https://docs.astro.build/';

const transformer: Transformer<Root> = (tree, file) => {
Expand Down
Loading

0 comments on commit 19fa02f

Please sign in to comment.