Install sage9 language files?

sage9

#1

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?


Localization of Blade templates
#2

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.


#3

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


#4

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


#5

Related discussion:


#6

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

Language .po and .mo totally ignored
#7

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


#8

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

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


#9

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?