Home Explore Blog CI



nushell

2nd chunk of `CONTRIBUTING.md`
3f1cb4313e6a7cee3b92201af6a207d7ab13bafad4b296e20000000100000c2e
1. Sync your fork on GitHub
1. `git pull` the latest changes
1. Run `npm run dev`

   Pay close attention to the messages when starting the server, as this will inform you of any broken links and other errors that might need to be fixed.

1. Create a branch for your changes using a short, descriptive name:

   ```nu
   git checkout -b my_changes
   ```

1. If you're adding a new page to the book, to make it appear, put it also to `.vuepress/configs/sidebar/{locale}.ts`.
1. Make changes
1. Verify your local changes render correctly by opening <http://localhost:8080/> in a web browser and navigating to the new or changed pages
1. Commit and push your changes

   ```nu
   git commit -m "Commit Message"
   git push --set-upstream origin my_changes
   ```

   (Where `my_changes` is the current branch)

1. Create a pull request in this GitHub repo

## Enabling a Preview URL From Your Fork

Just enable GitHub actions in your repo settings. That's all! It will start deploying the next time you push to `main`.

### Display Nu Code Snippets With Syntax Highlighting

To display Nushell code snippets with syntax highlighting support you can wrap the Nu codes with `` ```nu ``` `` or `` ```nushell ``` ``, for example:

````plain
```nu
# List the top five largest files
ls | where type == file | sort-by -r size | first 5
```
````

The preferred form for consistency is `` ```nu ``.

## Translation Guide

Follow the steps above for each group of translations.

### Adding to or updating existing translations

Check outdated translations. A helper script is provided for this. From the repository root, run:

```nu
nu tools/i18n.nu outdated zh-CN
```

This will provide a list of all files that have been changed or added since the last translation update for the specified locale.

### Creating a new translation

1. Add a book dir for the specified locale in the docs' root folder, say `zh-CN`.
1. Create a `book` child folder for all your translated documents and a README.md for the home page of your locale
1. Modify the VuePress config file `.vuepress/config.js` and add `zh-CN` related configs.

   Here is an [example commit](https://github.com/nushell/nushell.github.io/commit/46d1672) for reference.

1. Add a `README.md` in the `book` dir which will be the default introduction page of Nushell.

   ::: warning Important
   Please **DO NOT** translate the file name of the docs.
   :::

1. Run `npm run dev`, then open <http://localhost:8080/> in your browser
1. Switch to the language you are going to translate into, and you will see the introduction page you have just created. You can translate the docs and save them to get a preview in the browser.

1. Update the `i18n-meta.json` file by filling in the locale value of the doc you have just finished. It's recommended to use `commit_id@author` or simply a `commit_id` to indicate your translation end to the specified commit.
1. Commit your changes. It's recommended to squash all your commits in one commit with a commit message like this: `Translate your_doc_file.md to zh-CN from commit: f3dc86d3d`;
1. Push your changes as documented above

Title: Contributing Changes, Translation Guide, and Code Snippet Highlighting
Summary
This section details the process of contributing changes to the Nushell documentation and website, including syncing the fork, pulling the latest changes, running the development server, creating a branch, adding new pages, making changes, verifying the changes, committing and pushing the changes, and creating a pull request. It also explains how to enable preview URLs from your fork. Instructions are provided on how to display Nu code snippets with syntax highlighting using ```nu or ```nushell. A translation guide is included, covering adding to or updating existing translations and creating new translations, including steps for setting up a new locale, modifying the VuePress config file, and updating the i18n-meta.json file. The guide emphasizes the importance of not translating the filenames of the documentation.