Jump to content

[SOLVED] Some strings are not finded in Site Translation Files


Laegnur
 Share

Recommended Posts

Hello.

I'm almost a new user in Processwire. Now I'm adventuring myself into make a new website with this CMS, and adding multi-language support to it.

I installed the site using the blank profile, and install later the language support modules. Configure 3 languages, and add fields, templates and pages with translated labels, all correct.

But now, I have 5 strings across multiple template files that I need to translate.

strings.png.11c2ac95709255f021914a7d37fbaa5f.png

When I go to one of the languages, and build the phrase index it appears to find all the strings

phrase-index.thumb.png.7d303ed8d156898a3d9837b7d7e8f011.png

but when search for translatable files, it only find 4 string.

site_translation_files.png.69dcc46dec9188046b09a728b7827e73.png

The problematic string is the "_x('Developed by', 'developer')". What I'm doing wrong with this string?

  • Like 1
Link to comment
Share on other sites

Hi @Laegnur and welcome here.

Your issue come from the fact that your translated strings are on the same line (I admit it could be tricky to spot on first instance if you are not used with ProcessWire).

To understand better, please read this sentence :

Quote

Your translation function calls should be limited to one per line. The parser will not recognize more than one translation call per line so any additional calls after the first will be ignored by the parser. This is to ensure that you can adequately use comment descriptions (as mentioned earlier), as well as to ensure consistent and readable code.

 

So to get it working, write the first line on two lines lol :

<?php // i18n - copyright
echo _x('All rights reserver', 'copyright'); 
?> 
<!-- html markup - separator -->
|
<?php // i18n - developer 
echo _x('Developed by', 'developer');
?>

You can use of course the syntax you want, just keep in mind that the strings need to be on two lines.

For more information about: https://processwire.com/docs/multi-language-support/code-i18n/

  • Like 2
  • Thanks 2
Link to comment
Share on other sites

  • Laegnur changed the title to [SOLVED] Some strings are not finded in Site Translation Files
14 hours ago, Laegnur said:

That's what I get for not reading all the documentation.

I use ProcessWIre since 2014 (first real project with PW in 2015) but still that very little detail is even new to me.
Never had such an issue - for whatever reason.
But now I know.

 

BTW... welcome to the ProcessWire forums. Hope you enjoy your stay and find whatever you are looking for!

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...