Jump to content

Compiler does not output translations


K4mil
 Share

Recommended Posts

Hello

I've recently run into a trouble with translatable strings in my template files. Shortly speaking translatable strings show up properly in language panel, I can create and save translations, everything looks just fine in backend. The problem is that the only outputed value is the hardcoded one. It's definitely not a problem with template code itself because this happened even on simple test template with a  translatable string alone. 

There are no errors, I don't see anything special in logs. I just recently moved site from my local server to my ftp. There were some issues with paths in language files, but I have fixed it. It's the newest dev version of PW. I really don't have idea where to look, I'm fighting with this second day, and slowly loosing my nerves.

Link to comment
Share on other sites

Work like a charm! I was going crazy with this. I owe you, thanks!

Sidenote: 

<?php namespace ProcessWire; ?>

Should be added to the very file containing translatable strings (in case if it's attached by include() in the template)

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

Sometimes this isn't enough. There is an issue, if the template file sits in a subdirectory under site/templates and has to be processed by the file compiler.

I filed the issue here.

As a workaround, I changed a line in wire/modules/LanguageSupport/LanguageTranslator.php:

original line (# 229):

if($pos) $filename = substr($filename, $pos+20);

to be replaced with:

if($pos) $filename = preg_replace("@^.*?cache/FileCompiler/@", wire('config')->urls->templates, $filename);

 

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

×
×
  • Create New...