n8n Chinese Localization

repository·main·Indexed 24 days ago

https://github.com/other-blowsnow/n8n-i18n-chinese

Provides methods to enable Chinese language localization (i18n) for n8n. Includes a pre-built Docker image (blowsnow/n8n-chinese), instructions for manual replacement in official n8n Docker images, and local installation via npx. Supports configuration using the N8N_DEFAULT_LOCALE=zh-CN environment variable.

Tokens
1.1K
Snippets
4
Records
6
Agent score
31%

What's inside n8n-i18n-chinese

  1. How n8n Chinese localization works

    main
    The editor-ui component in n8n supports i18n, but language packs are not exposed by default. The localization works by adding a zh-CN.json file to the editor-ui directory at /src/plugins/i18n/locales/ and then re-compiling the project. Once the files are present in the dist folder, setting the N8N_DEFAULT_LOCALE=zh-CN environment variable triggers the use of the Chinese language pack.
  2. Install Chinese localization on official n8n Docker image

    main

    If you prefer using the official n8nio/n8n image, you can manually mount the Chinese editor UI files into the container. You must replace 【替换为下载的编辑器UI目录】 with the local path to the downloaded Chinese editor-ui directory.

    docker run -it --rm --name n8ntest \
    -p 15678:5678 \
    -v 【替换为下载的编辑器UI目录】:/usr/local/lib/node_modules/n8n/node_modules/n8n-editor-ui/dist \
    -v ~/.n8n:/home/node/.n8n \
    -e N8N_DEFAULT_LOCALE=zh-CN \
    -e N8N_SECURE_COOKIE=false \
    n8nio/n8n
  3. Install Chinese localization via npx (Local Replacement)

    main

    To apply Chinese localization to a local n8n installation started via npx, follow these steps:

    1. Locate the dist directory: Find the n8n-editor-ui/dist folder in your local npm cache. Common paths include:
      • C:\Users\xxxxxx\AppData\Local\npm-cache\_npx\n8n\node_modules\n8n-editor-ui\dist
      • C:\Users\xxxxxx\AppData\Roaming\npm\node_modules\n8n\node_modules\n8n-editor-ui\dist
    2. Download files: Download the corresponding editor-ui.tar.gz file containing the Chinese localization.
    3. Replace files: Extract the contents of the archive into the dist directory, replacing the existing files.
    4. Set Environment Variable: Set the environment variable N8N_DEFAULT_LOCALE=zh-CN.
    5. Restart: Restart your n8n service.
  4. Install n8n with Chinese localization via Docker Image

    main

    The easiest way to use n8n with Chinese localization is to use the pre-built blowsnow/n8n-chinese Docker image. This image comes with the necessary Chinese language files pre-configured.

    Run the following command to start a test instance:

    docker run -it --rm --name n8ntest \
    -p 15678:5678 \
    -v ~/.n8n:/home/node/.n8n \
    -e N8N_SECURE_COOKIE=false \
    blowsnow/n8n-chinese
  5. Deploy n8n with Chinese localization via Docker Compose

    main

    You can use the provided docker-compose.yml to deploy an n8n instance that includes Chinese language support. This configuration works by mounting a pre-translated editor-ui-dist directory over the default n8n editor UI files and setting the default locale environment variable.

    Key Configuration Details:

    • Image: Uses n8nio/n8n:{version}. Ensure you replace {version} with a valid n8n version tag.
    • Ports: Maps host port 15678 to container port 5678.
    • Environment Variables:
      • N8N_DEFAULT_LOCALE=zh-CN: Sets the default interface language to Chinese.
      • N8N_SECURE_COOKIE=false: Disables secure cookies (useful for local testing).
    • Volume Mapping: The local directory ./editor-ui-dist must contain the Chinese translation files and is mounted to /usr/local/lib/node_modules/n8n/node_modules/n8n-editor-ui/dist inside the container to override the default UI.
    version: '3.8'
    
    services:
      n8ntest:
        image: n8nio/n8n:{version}
        container_name: n8ntest
        ports:
          - "15678:5678"
        environment:
          - N8N_DEFAULT_LOCALE=zh-CN
          - N8N_SECURE_COOKIE=false
        volumes:
          - ./editor-ui-dist:/usr/local/lib/node_modules/n8n/node_modules/n8n-editor-ui/dist
        stdin_open: true
        tty: true
        restart: unless-stopped