type | order | title | permalink | category | body_class |
---|---|---|---|---|---|
docs |
6 |
Locale Packs |
docs/locales/ |
Docs |
page-docs-locales |
Uppy speaks many languages, English being the default. You can use a locale pack to translate Uppy into your language of choice.
This is the recommded way. Install @uppy/locales
package from npm, then choose the locale you’d like to use: @uppy/locales/lib/LANGUAGE_CODE
.
npm i @uppy/core @uppy/locales
import Uppy from '@uppy/core'
import German from '@uppy/locales/lib/de_DE'
// see below for the full list of locales
const uppy = new Uppy({
debug: true,
locale: German,
})
Add a <script>
tag with Uppy bundle and the locale pack you’d like to use. You can copy/paste the link from the CDN column in the locales table. The locale will attach itself to the Uppy.locales
object.
<script src="https://releases.transloadit.com/uppy/v2.3.2/uppy.min.js"></script>
<script src="https://releases.transloadit.com/uppy/locales/v2.0.5/de_DE.min.js"></script>
<script>
var uppy = new Uppy.Core({
debug: true,
locale: Uppy.locales.de_DE
})
</script>
Many plugins come with their own locale strings, and the packs we provide consist of most of those strings. You can, however, override a locale string for a specific plugin, regardless of whether you are using locale pack or not. See the plugin documentation for the list of locale strings it uses (for example, here’s how to use it with the Dashboard UI).
import Uppy from '@uppy/core'
import DragDrop from '@uppy/drag-drop'
import Russian from '@uppy/locales/lib/ru_RU'
const uppy = new Uppy({
debug: true,
autoProceed: true,
locale: Russian,
})
uppy.use(DragDrop, {
target: '.UppyDragDrop',
// We are using the ru_RU locale pack (set above in Uppy options),
// but you can also override specific strings like so:
locale: {
strings: {
browse: 'выберите ;-)',
},
},
})
If you speak a language we don’t yet support, you can contribute! Here’s how you do it:
- Go to the uppy/locales directory in the Uppy GitHub repo.
- Go to
en_US.js
and copy its contents, as English is the most up-to-date locale. - Press “Create new file”, name it according to the
language_COUNTRY
format, make sure to use underscore_
as a divider. Examples:en_US
,en_GB
,ru_RU
,ar_AE
. Variants should be trailing, for examplesr_RS_Latin
for Serbian Latin vs Cyrillic. - If your language has different pluralization rules than English, update the
pluralize
implementation. If you are unsure how to do this, please ask us for help in a GitHub issue. - Paste what you’ve copied from
en_US.js
and use it as a starting point to translate strings into your language. - When you are ready, save the file — this should create a PR that we’ll then review 🎉 Thanks!