# How to add a new language

**URL:** https://meta.discourse.org/t/how-to-add-a-new-language/14970
**Category:** Translations
**Tags:** translation
**Created:** [April 22, 2014, 2:25pm UTC](https://meta.discourse.org/t/how-to-add-a-new-language/14970 "2014-04-22T14:25:05Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [April 22, 2014, 2:25pm UTC](https://meta.discourse.org/t/how-to-add-a-new-language/14970/1 "2014-04-22T14:25:05Z")

</div>

# Contribute translations

The first step is to do some translating in [our Crowdin workspace](https://translate.discourse.org/). Create an account and start translating in one or more languages. See [Contributing translations to Discourse](https://meta.discourse.org/t/contribute-a-translation-to-discourse/14882) for more information about that.

# Add language to Discourse

> ⚠ These instructions are currently out of date!

You have two options when you think that the translation is ready to be included in Discourse:

1. Post in this topic and ask for your language to be included in Discourse. There might be a helpful community member who will add it for you.

2. You add it yourself. 💪  
If you do, please read on…

## Requirements

You will need a development environment ([Linux](https://meta.discourse.org/t/beginners-guide-to-install-discourse-on-ubuntu-for-development/14727), [macOS](https://meta.discourse.org/t/beginners-guide-to-install-discourse-on-mac-os-x-macos-for-development/15772) or [Windows](https://meta.discourse.org/t/beginners-guide-to-install-discourse-on-windows-10-for-development/75149)) and a working [Transifex client](https://meta.discourse.org/t/contribute-a-translation-to-discourse/14882). Moreover, you need [to fork](https://help.github.com/articles/fork-a-repo/) and clone the [discourse](https://github.com/discourse/discourse) and [translations-manager](https://github.com/discourse/translations-manager) git repositories.

## Find the language codes

I’ll use Welsh (cy\_GB) as an example to show you the next steps. First, take not of the language code used by Transifex. It will look like this:  
 ![image](https://global.discourse-cdn.com/meta/original/3X/9/8/98b00c7c02bf58753dae767f714f12a4afa3f71a.png)

> 💡 In some cases, Transifex will use a language code that isn’t supported in Rails.

In order to find out, take a look at [`config/locales/plurals.rb`](https://github.com/discourse/discourse/blob/master/config/locales/plurals.rb) in the `discourse` repository. For Welsh you will find a line like this:

```ruby
cy: { i18n: { plural: { keys: [:one, :two, :many, :other], rule: lambda { |n| n == 1 ? :one : n == 2 ? :two : n == 8 || n == 11 ? :many : :other } } } },

```

So, the language code in Transifex is `cy_GB` and `cy` in Discourse.

## Add language to translations-manager

Edit [`lib/translations_manager/locales.rb`](https://github.com/discourse/translations-manager/blob/master/lib/translations_manager/locales.rb) in the `translations-manager` repository and add the language code used by Discourse to the `SUPPORTED_LOCALES` array.

Add an entry to the `LANGUAGE_MAP` hash if the language code in Transifex differs from the one used by Discourse.

The diff for Welsh would look like this:

```diff
@@ -5,6 +5,7 @@ module TranslationsManager
     'bs_BA',
     'ca',
     'cs',
+ 'cy',
     'da',
     'de',
     'el',
@@ -44,6 +45,7 @@ module TranslationsManager
 
   # 'language code in transifex' => 'language code in Discourse'
   LANGUAGE_MAP = {
+ 'cy_GB' => 'cy',
     'el_GR' => 'el',
     'es_ES' => 'es',
     'fr_FR' => 'fr',

```

Next, commit your changes and [create a pull request](https://help.github.com/articles/creating-a-pull-request-from-a-fork/).

## Add language to Discourse

> ⚠ You need to wait for your pull request to be merged if you added an entry to `LANGUAGE_MAP`. If you didn’t, you can continue right away.

Run `script/pull_translations.rb <language_code>` in your `discourse` directory – `<language_code>` is the code used by Discourse. It will download all translations from Transifex and do some post-processing afterwards.

## Transliteration (optional)

Discourse generates slugs from topic titles. Those are the nice looking topic titles in URLs. For example, this topic’s URL contains: /t/ **how-to-add-a-new-language** /14970

But that only works for ASCII characters. You can add transliteration rules for your character set by creating the following file: `/config/locales/transliterate.<language_code>.yml`

You can take a look at the various existing files (e.g. [`transliterate.ru.yml`](https://github.com/discourse/discourse/blob/master/config/locales/transliterate.ru.yml)) if you need some inspiration.

> 💡 The [slug generation method](https://meta.discourse.org/t/removing-the-concept-of-slugs-for-some-languages/26643/16) can be configured in the site settings. You don’t need to create transliteration rules if the users in your country are accustomed to encoded slugs or prefer to have no slugs.
> 
> ![image](https://global.discourse-cdn.com/meta/original/3X/a/3/a365d8ada5975020b666a6669f975ac589cc37e2.png)
> 
> You can also change the default slug generation method for your language in [`site_settings.yml`](https://github.com/discourse/discourse/blob/ef2362a30fe1a1cb5e7c15e70c5332adf14c7d0b/config/site_settings.yml#L1650-L1656).

## Right-to-left (optional)

If the new language is a right-to-left script then you also need to add the `<language_code>` to the `rtl?` method in [`app/helpers/application_helper.rb`](https://github.com/discourse/discourse/blob/14af90df5b68548872eb06d0875c9ba41c9ecf70/app/helpers/application_helper.rb#L176-L178).

## Final checks

Now it’s time to make sure that everything is configured correctly.

#### Plural rules

Discourse has two files with plural rules – for Ruby and JavaScript. Please verify that the rules match the ones defined in the [The Unicode Consortium’s Plural Rules](http://www.unicode.org/cldr/charts/29/supplemental/language_plural_rules.html).

- `config/locales/plurals.rb`
- `lib/javascripts/locale/<language_code>.js`

#### Language name

The file `config/locales/names.yml` should contain an entry for your language. Please make sure that the language code exists and that the `nativeName` is correct. For Welsh it looks like this:

```plaintext
cy:
  name: Welsh
  nativeName: Cymraeg

```

#### Other files

The following files also need to exist:

- `vendor/assets/javascripts/moment-locale/<language_code>.js`

> 💡 The language code doesn’t have to match exactly. Only the part before the hyphen must match. So, for Welsh it doesn’t make any difference if the file is named `cy-gb.js` or `cy.js` – they are considered the same.

#### Integration tests

Run the following tests suite to check for known integrity issues:

```plaintext
bundle exec rspec spec/integrity/i18n_spec.rb
bundle exec rspec spec/components/js_locale_helper_spec.rb

```

It’s also a good idea to check for obvious errors in the translation files as described in [How to check locale files for errors](https://meta.discourse.org/t/how-to-check-locale-files-for-errors/96527).

#### Live test

Start your Rails server and test that you can change to the new language using the `default locale` site setting.

## Submit your Pull Request

If everything works, commit the files and send us a pull request. 🎉

---

<div class="post-metadata">

### Author: ![renis](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/renis/32/33238_2.png) [@renis](https://meta.discourse.org/u/renis)
#### Post date: [September 18, 2014, 11:26pm UTC](https://meta.discourse.org/t/how-to-add-a-new-language/14970/3 "2014-09-18T23:26:15Z")

</div>

Can I use a partial translated language?

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [September 19, 2014, 3:47pm UTC](https://meta.discourse.org/t/how-to-add-a-new-language/14970/4 "2014-09-19T15:47:37Z")

</div>

You mean a language that doesn’t show as 100% complete in Transifex? Yes you can, but there may be missing translations in some places. It won’t break the site, but it won’t look pretty.

---

<div class="post-metadata">

### Author: ![foobar1234](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/foobar1234/32/114949_2.png) [@foobar1234](https://meta.discourse.org/u/foobar1234)
#### Post date: [September 20, 2014, 10:43am UTC](https://meta.discourse.org/t/how-to-add-a-new-language/14970/6 "2014-09-20T10:43:23Z")

</div>

Is there a way to copy all translations for a language A into language B, and then work on language B?

I’m working on the Catalan translation, and what would be easiest is to leverage the already-made Spanish translation as a basis (I’m fluent in both langs).

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [September 20, 2014, 11:43am UTC](https://meta.discourse.org/t/how-to-add-a-new-language/14970/7 "2014-09-20T11:43:50Z")

</div>

This is untested, but you could try to download the Spanish translation files in Transifex and upload them as Catalan translations.

 ![](https://global.discourse-cdn.com/meta/original/3X/d/f/df3685c8469ee696e9be498782958becb80e6f55.png)

---

<div class="post-metadata">

### Author: ![foobar1234](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/foobar1234/32/114949_2.png) [@foobar1234](https://meta.discourse.org/u/foobar1234)
#### Post date: [September 20, 2014, 11:49am UTC](https://meta.discourse.org/t/how-to-add-a-new-language/14970/8 "2014-09-20T11:49:59Z")

</div>

Oh yes that does make a lot of sense. I will try. Thanks!

Edit: it did work. The YML file transifex generated was slightly broken (couple newlines missing) and could not be uploaded verbatim, but after fixing it I can work with Spanish as a basis. Thanks!

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [May 29, 2018, 10:57am UTC](https://meta.discourse.org/t/how-to-add-a-new-language/14970/67 "2018-05-29T10:57:24Z")

</div>

I’ve completly reworked [the guide in the first post](https://meta.discourse.org/t/how-to-add-a-new-language/14970) because a lot has changed over the past couple of years.

Unfortunately adding a new language doesn’t work without a development environment anymore. If you feel that’s too much for you to handle, feel free to ask us to add it for you. But, if you like a challenge, adding a new language could be a great task to get accustomed to Discourse. 😉

---

<div class="post-metadata">

### Author: ![asrob](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/asrob/32/186601_2.png) [@asrob](https://meta.discourse.org/u/asrob)
#### Post date: [August 8, 2018, 10:22am UTC](https://meta.discourse.org/t/how-to-add-a-new-language/14970/74 "2018-08-08T10:22:03Z")

</div>

I’ve created a pull request to add Hungarian language. I hope it will be OK. 🙂  
[https://github.com/discourse/translations-manager/pull/2](https://github.com/discourse/translations-manager/pull/2)

---

<div class="post-metadata">

### Author: ![asrob](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/asrob/32/186601_2.png) [@asrob](https://meta.discourse.org/u/asrob)
#### Post date: [August 11, 2018, 10:52pm UTC](https://meta.discourse.org/t/how-to-add-a-new-language/14970/75 "2018-08-11T22:52:16Z")

</div>

Created another pull request to use Hungarian locale.

[https://github.com/discourse/discourse/pull/6260](https://github.com/discourse/discourse/pull/6260)

---

<div class="post-metadata">

### Author: ![asrob](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/asrob/32/186601_2.png) [@asrob](https://meta.discourse.org/u/asrob)
#### Post date: [August 13, 2018, 7:02am UTC](https://meta.discourse.org/t/how-to-add-a-new-language/14970/76 "2018-08-13T07:02:40Z")

</div>

My PR has merged. Thanks! 🤘🎉

---

<div class="post-metadata">

### Author: ![ctataru](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ctataru/32/195404_2.png) [@ctataru](https://meta.discourse.org/u/ctataru)
#### Post date: [October 1, 2018, 9:26am UTC](https://meta.discourse.org/t/how-to-add-a-new-language/14970/81 "2018-10-01T09:26:21Z")

</div>

I just started working on completing the Romanian translation over at Transifex. I am unsure about how often the language files in live existing instances of Discourse are being updated. Are they refreshed from Transifex with every launcher app rebuild?  
Thank you.

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [October 1, 2018, 9:34am UTC](https://meta.discourse.org/t/how-to-add-a-new-language/14970/82 "2018-10-01T09:34:58Z")

</div>

Rebuilding the app container won’t update the translations unless they were updated in our GitHub repository. The translations are usually updated with every release of a new beta version.

---

<div class="post-metadata">

### Author: ![Vikas\_Dangi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vikas_dangi/32/131628_2.png) [@Vikas\_Dangi](https://meta.discourse.org/u/Vikas_Dangi)
#### Post date: [May 21, 2019, 8:13pm UTC](https://meta.discourse.org/t/how-to-add-a-new-language/14970/83 "2019-05-21T20:13:46Z")

</div>

From last 45 days we are working hard to translate **Hindi (hi)** language. Currently we are somewhere 24%

In some translations, we need to cross check them on live site whether they are relevant or not. So please someone add hindi (hi) to discourse so we can continue to make it better.

---

<div class="post-metadata">

### Author: ![nickevackerdag](https://avatars.discourse-cdn.com/v4/letter/n/b19c9b/32.png) [@nickevackerdag](https://meta.discourse.org/u/nickevackerdag)
#### Post date: [April 23, 2020, 8:12am UTC](https://meta.discourse.org/t/how-to-add-a-new-language/14970/84 "2020-04-23T08:12:53Z")

</div>

Hi!

Is it possible to have **more than one translation of the same language** , or have you limited it to one translation per language?

I recently became a member of a Discourse community in Sweden. I think the translation to Swedish is quite lacking. It follows the English language version closely, but it isn’t as **human-friendly** as I would like. Many words and phrases could be left as is (because they aren’t very important to the average user), but there also are many that needs changes to be **easily understandable** to someone new to the community world.

Best regards, Niklas

---

<div class="post-metadata">

### Author: ![mbaker341997](https://avatars.discourse-cdn.com/v4/letter/m/c6cbf5/32.png) [@mbaker341997](https://meta.discourse.org/u/mbaker341997)
#### Post date: [January 6, 2021, 5:18pm UTC](https://meta.discourse.org/t/how-to-add-a-new-language/14970/85 "2021-01-06T17:18:53Z")

</div>

Hi, what’s the current guidance for adding a new language? These instructions are marked out-of-date and the [pull\_translations script no longer exists](https://github.com/discourse/discourse/commit/29788f2c26bb198dc6820cc635c944f430d6f2bd). Does discourse-stranslator-bot handle everything for us once the translations are in Crowdin?

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [January 6, 2021, 6:55pm UTC](https://meta.discourse.org/t/how-to-add-a-new-language/14970/86 "2021-01-06T18:55:12Z")

</div>

We will add new languages when the translation progress for core is at least at 50%.

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [May 26, 2024, 10:27pm UTC](https://meta.discourse.org/t/how-to-add-a-new-language/14970/88 "2024-05-26T22:27:31Z")

</div>


