1

I'm having trouble outputting static translations for the primary site, and only the primary site.

Translations structure:

  • translations
    • en-US
      • site.php

site.php

<?php

return [
  'UNIQUE_KEY_NAME' => `This is the string I'd like to appear.`,
];

Template

{{ 'UNIQUE_KEY_NAME' | t }}

Output

UNIQUE_KEY_NAME

Is there a way to make this pattern work? The advantage of storing microcopy and site furniture in a single location is that it is much easier to update and share with copywriters.

If there is a second site, then it appears the site.php for that language will be respected, but when there is just one site, the primary site, its corresponding site.php translation file appears to be ignored. Is this intended?

Thanks 🙏

1 Answer 1

1

I think the error is to do with the fact that you are using backticks (slanted quote) instead of single/double quote marks.

Copy/paste the below and it should work for you

<?php

return [
  'UNIQUE_KEY_NAME' => 'This should now work',
];
1
  • OMG! This is such an epic facepalm. I'm so used to using backticks in JavaScript now! This is what happens... I literally never post any support requests, then when I do, they end up being the dumbest thing ever because I'm "having one of those days". Jeez. Thank you so much for honouring my stupidity with a polite reply. 🤦‍♂️
    – tomkiss
    Jul 20, 2020 at 10:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.