Roots Discourse

Trying to translate my sage 10 beta 2 theme. Not all strings appear in sage.pot

Hi
I noticed that the translations scripts were removed from package.json.

Probably for some good reason.

I tried to add them again, so I’ve added these lines to package.json:

"translate": "npm run translate:pot && npm run translate:js",
"translate:pot": "wp i18n make-pot . ./resources/lang/sage.pot --ignore-domain --include=\"app,resources\"",
 "translate:js": "wp i18n make-json ./resources/lang --pretty-print"

I then run yarn translate

I seems to work just fine. But when I open the newly generated file /ressources/lang/sage.pot, it only contains strings from the /app folder - but not all the strings that I have added in my templates in the ‘/views/partials’-folder.

In my /views/partials/searchform.blade.php, I have these strings:

@php
echo __('Translate me', 'sage');
@endphp

{!! __('Translate me too!!!', 'sage') !!}

But they dont show up in the sage.pot-file. Any help would be appreciated :slight_smile:

1 Like

Howdy! Those scripts were accidentally removed when we switched to Bud — we actually need to get them re-added

There’s this issue that might have some helpful info on getting the file generated correctly: `yarn translate:pot` failing if public folder is generated · Issue #2672 · roots/sage · GitHub

I was able to follow @gmutschler’s notes on there to get a pot file generated with all expected strings

1 Like

Thanks, Ben
I’ve ran the following command in my terminal which I copy/pasted from your link and my strings are now in my pot-file:

wp acorn view:cache && wp i18n make-pot ../../ ./resources/lang/sage.pot --ignore-domain --include=\"themes/theme_folder/app,themes/theme_folder/resources,cache/acorn/views\" --exclude=\"themes/theme_folder/public,plugins,languages,upgrade,uploads,index.php\"

NB: I replaced “theme_folder” with my themes folder name

1 Like