Install sage9 language files?

Sage translations can be obtained from the sage-translations repository.

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?

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.

1 Like

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

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).

Related discussion:

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' );
} );

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

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

Function Reference/load theme textdomain « WordPress Codex

<?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

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?