Closed jorditarrida closed 6 years ago
Hey
Could you show us your file for models
- it will be easier for us to help you.
If you are using the json or yaml files the reason they aren't translate is the fact that sage translate only php by default:
"mkdir -p ./resources/lang && find ./resources ./app -iname '*.php'
To fix this take a look at https://www.tecmint.com/linux-find-command-to-search-multiple-filenames-extensions/
In case use are using php files - do you keep them in app directory?
Hi @palmiak,
Thanks for your answer. I was originally using .json
files so thanks to your comment I realized the easiest thing to do in this case was to use .php
files. Although it is not documented, I used the gettext functions inside the .php
file and when I ran yarn pot
(following the instructions in my original post) the strings were properly registered for translation:
'labels' => [
'has_one' => __( 'Product', 'my-text-domain' ),
'has_many' => __( 'Products', 'my-text-domain' ),
'text_domain' => 'my-text-domain'
],
So I'll leave this here in case anyone else needs to do something similar.
Thanks again for your time! Jordi
Thanks for the explanation. I'll add this solution to the documentation soon.
Hi,
I am using Models within a Roots Sage based theme. I followed the Sage instructions to generate a
.pot
file for translation, but the script does not register thelabel
strings for translation. Is there any way to do it?Thanks in advance for your help!