# Install sage9 language files?

**URL:** https://discourse.roots.io/t/install-sage9-language-files/10638
**Category:** sage
**Tags:** sage9
**Created:** 2017-10-11T14:34:34Z
**Posts:** 9

## Post 1 by @strarsis — 2017-10-11T14:34:34Z

Sage translations can be obtained from the [sage-translations repository](https://github.com/roots/sage-translations).

Where do I have to place the mo files in a sage 9 project? Can I automate downloading the language files? Can the wp cli do this as with other plugins or themes or core?

---

## Post 2 by @evance — 2017-12-11T15:24:57Z

I cannot comment on the automation part (_also interested_) but an easy way to implement the translation would be to place the .po / .mo-files under `wp-content/languages/themes/sage-xx_XX`.

---

## Post 3 by @strarsis — 2017-12-23T18:14:02Z

There is also the folder in `[...]web/app/themes/[sage theme]/lang` - does it still apply to sage9?

---

## Post 4 by @strarsis — 2018-01-21T08:07:39Z

I bump this thread because I am still unsure of the difference between  
`[...]web/app/themes/[sage 9 based theme]/lang/` and  
`wp-content/languages/themes/sage/`  
for the sage language files (of a sage 9 based theme).

---

## Post 5 by @strarsis — 2018-02-13T17:21:48Z

Related discussion:

> [@Localization of Blade templates](https://discourse.roots.io/t/localization-of-blade-templates/9331/9):
>
> The pot build command created a new directory ./resources/lang/ with sage.pot inside. I downloaded language files from the [https://github.com/roots/sage-translations](https://github.com/roots/sage-translations) repository and placed it in same ./resources/lang/ folder. However, the sage9 related strings are still not translated. Edit: Also saved a new translation using the generated sage.pot as template, but the resulting .po isn’t used by the site either.

---

## Post 6 by @felly — 2018-02-18T16:23:10Z

Actually you can put your language files anywhere you want - you just need to tell Wordpress about that folder.  
e.g. you can put your language files directly in your theme directory under `resources/lang` and add this action to `setup.php`:

```
add_action( 'after_setup_theme', function () {
  load_theme_textdomain( 'sage', get_template_directory() . '/lang' );
} );
```

---

## Post 7 by @strarsis — 2018-02-19T00:19:55Z

Will this still use the text domain for the theme based on sage?

---

## Post 8 by @felly — 2018-02-19T07:53:43Z

The text domain is the first parameter used in the function:

> [Function Reference/load theme textdomain « WordPress Codex](https://codex.wordpress.org/Function_Reference/load_theme_textdomain)
> 
> ```
> <?php load_theme_textdomain( $domain, $path ) ?>
> 
> $domain
> ```
> 
> (string) (required) Unique identifier for retrieving translated strings.  
> Default: None
> 
> ```
> $path
> ```
> 
> (unknown) (optional) The directory where the .mo file can be found (without the trailing slash).  
> Default: false

---

## Post 9 by @strarsis — 2018-02-19T13:52:52Z

It is probably a better practice to use one single text domain for the whole theme, merging the sage9 translation strings with the (newly added/custom/on top of the sage9 one) ones of the derived theme?
