Skip to content

Commit

Permalink
fix #89
Browse files Browse the repository at this point in the history
  • Loading branch information
djyde authored May 7, 2021
1 parent e4e1e1f commit 8152151
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions public/doc/advanced/i18n.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,23 @@ Cusdis comment widget has international support. But for keeping the SDK lightwe

## Usage

Before the sdk script, add locale specific script:

```js
<div id="cusdis_thread"
data-host="https://cusdis.com"
data-app-id="{{ APP_ID }}"
data-page-id="{{ PAGE_ID }}"
data-page-url="{{ PAGE_URL }}"
data-page-title="{{ PAGE_TITLE }}"
>
<script defer src="https://cusdis.com/js/widget/lang/zh-cn.js"></script>
<script defer src="https://cusdis.com/js/cusdis.es.js"></script>
Before the sdk script, add locale specific script: `https://cusdis.com/js/widget/lang/{LANG_CODE}.js`, for example:

```diff
<div id="cusdis_thread"
data-host="https://cusdis.com"
data-app-id="{{ APP_ID }}"
data-page-id="{{ PAGE_ID }}"
data-page-url="{{ PAGE_URL }}"
data-page-title="{{ PAGE_TITLE }}"
>
+ <script defer src="https://cusdis.com/js/widget/lang/zh-cn.js"></script>
<script defer src="https://cusdis.com/js/cusdis.es.js"></script>
```

All availabe locale files are in https://cusdis.com/js/widget/lang/LANG_CODE.js

> Make sure the locale specific script is loaded before the sdk.
> Should change the script host to your own server if you are using self-host Cusdis.
> Should change the script host to your own server if you are using self-host Cusdis. (e.g. `https://your-domain.com/js/widget/lang/zh-cn.js` )
## Current support language

Expand All @@ -42,6 +40,6 @@ window.CUSDIS_LOCALE = {
}
```

You can find all available keys in `widget/lang/en.js`.
You can find all available keys in https://github.com/djyde/cusdis/blob/master/widget/lang/en.js.

Feel free to create a PR!

1 comment on commit 8152151

@vercel
Copy link

@vercel vercel bot commented on 8152151 May 7, 2021

Choose a reason for hiding this comment

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

Please sign in to comment.