Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Make command work on both Linux and Windows #8704

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions website/docs/i18n/i18n-tutorial.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -390,11 +390,43 @@ Official Docusaurus content plugins extensively use Markdown/MDX files and allow

Copy your docs Markdown files from `docs/` to `i18n/fr/docusaurus-plugin-content-docs/current`, and translate them:

<Tabs>
<TabItem value="Linux">

```bash
mkdir -p i18n/fr/docusaurus-plugin-content-docs/current
cp -r docs/** i18n/fr/docusaurus-plugin-content-docs/current
mkdir -p i18n\fr\docusaurus-plugin-content-docs\current
cp -r docs\** i18n\fr\docusaurus-plugin-content-docs\current
Comment on lines +397 to +398
Copy link
Contributor

@armano2 armano2 May 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this command is working fine on windows as long as you use powershell instead of cmd

image

tested in PowerShell 7.3.4

https://learn.microsoft.com/en-us/powershell/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Sebastién that a single, cross-platform command would be best. See here: #8704 (review)

```

</TabItem>

<TabItem value="Windows">

```bat
mkdir i18n\fr\docusaurus-plugin-content-docs\current
Xcopy docs i18n\fr\docusaurus-plugin-content-docs\current /E /C /I /D
```

:::caution

The second command opens a prompt. Answer "No" to all. Otherwise, you'd get rid of existing translations.

:::

:::info

| Flag | Effect |
| ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| /E | Copies all subdirectories, even if they are empty. |
| /C | Ignores errors. |
| /I | If source is a directory or contains wildcards and destination does not exist, xcopy assumes destination specifies a directory name and creates a new directory. |
| /D | Only replaces the destination files with the source files if the source files are newer. |

:::

</TabItem>
</Tabs>

:::info

Notice that the `docusaurus-plugin-content-docs` plugin always divides its content by versions. The data in `./docs` folder will be translated in the `current` subfolder and `current.json` file. See [the doc versioning guide](../guides/docs/versioning.mdx#terminology) for more information about what "current" means.
Expand Down