wayne Posted February 17, 2014 Share Posted February 17, 2014 To make it short: - I downloaded the latest German language pack from github and installed it - default.php from AdminTheme module suggests to translate "/wire/templates-admin/default.php" and I checked, it already is - everything but the admin/backend menu and breadcrumbs is translated Did I miss or oversee something? Link to comment Share on other sites More sharing options...
Radek Posted February 17, 2014 Share Posted February 17, 2014 Hi, wayne i made little test here and it works for me so this must be some enviroment problem same as manfred62 mentioned before. Can you try czech language pack i tested it on several systems without problems and i am curious if it is affected on your system too. Link to comment Share on other sites More sharing options...
wayne Posted February 17, 2014 Author Share Posted February 17, 2014 Hi Radek, the Czech language pack isn't working just like the German one. Thanks for pointing to the environment, I will have a look at my setup. EDIT: I found the problem. It's the Windows environment and it's backslash pathes. PW uses the DIRECTORY_SEPARATOR constant in its php code that is a backslash character under Windows. Basically this is correct. But php isn't quite consistent in that matter. The translation function gets pathes with normal slashes although the code uses backslashes because of the DIRECTORY_SEPARATOR constant. The only function that seems to cause that problem is in "wire/modules/LanguageSupport/Languagetranslator.php": protected function textdomainString($textdomain) { if(is_string($textdomain) && strpos($textdomain, DIRECTORY_SEPARATOR) !== false) $textdomain = $this->filenameToTextdomain($textdomain); else if(is_object($textdomain)) $textdomain = $this->objectToTextdomain($textdomain); else $textdomain = strtolower($textdomain); // just in case there is an extension on it, remove it if(strpos($textdomain, '.')) $textdomain = basename($textdomain, '.json'); return $textdomain; } If you replace DIRECTORY_SEPARATOR with a simple '/', it works. (EDIT3: That change isn't enough, look at the posts below.) I don't know if there is a clean solution or if one should write it off as a Windows php quirk. A quick and dirty fix would be to check for a backslash and a normal slash as directory separator. EDIT2: In the subroutine "filenameToTextdomain" I found an existing directory separator fix: if(DIRECTORY_SEPARATOR != '/') $filename = str_replace(DIRECTORY_SEPARATOR, '/', $filename); But for the problem explained above it comes one subroutine to late. I think it's now on Ryan to decide where and how to fix that check for the DIRECTORY_SEPARATOR in the "textdomainString" function. 3 Link to comment Share on other sites More sharing options...
dazzyweb Posted March 21, 2014 Share Posted March 21, 2014 I also have the same problem. Link to comment Share on other sites More sharing options...
Manfred62 Posted March 25, 2014 Share Posted March 25, 2014 in the new dev version this problem is still there. @ryan: any chance to get this fixed? ================================ EDIT: tested in the new dev version 2.4.1. When you change this: If you replace DIRECTORY_SEPARATOR with a simple '/', it works. the translation for the headings under Setup and Access is broken 1 Link to comment Share on other sites More sharing options...
wayne Posted March 26, 2014 Author Share Posted March 26, 2014 the translation for the headings under Setup and Access is broken Like I said before, the use of / and \ is quite inconsistent. I guess that condition should check for both kinds of slashes under Windows. Could you try to change if(is_string($textdomain) && strpos($textdomain, DIRECTORY_SEPARATOR) !== false) $textdomain = $this->filenameToTextdomain($textdomain); to if(is_string($textdomain) && (strpos($textdomain, DIRECTORY_SEPARATOR) !== false || strpos($textdomain, '/') !== false)) $textdomain = $this->filenameToTextdomain($textdomain); ? EDIT: I tested it, and that works (at least for me). Link to comment Share on other sites More sharing options...
Manfred62 Posted March 27, 2014 Share Posted March 27, 2014 Hi wayne, tested your code (line 207 in LanguageTranslator.php). Nice, seems to work and fix the problem! Can you make a pull request on GitHub, so Ryan can check this code and adopt it? Link to comment Share on other sites More sharing options...
wayne Posted March 27, 2014 Author Share Posted March 27, 2014 I'm not using Git respectively Github for code development (yet). But I created an issue: https://github.com/ryancramerdesign/ProcessWire/issues/424 Link to comment Share on other sites More sharing options...
Ivan Gretsky Posted May 12, 2014 Share Posted May 12, 2014 Like I said before, the use of / and \ is quite inconsistent. I guess that condition should check for both kinds of slashes under Windows. Could you try to change if(is_string($textdomain) && strpos($textdomain, DIRECTORY_SEPARATOR) !== false) $textdomain = $this->filenameToTextdomain($textdomain); to if(is_string($textdomain) && (strpos($textdomain, DIRECTORY_SEPARATOR) !== false || strpos($textdomain, '/') !== false)) $textdomain = $this->filenameToTextdomain($textdomain); ? EDIT: I tested it, and that works (at least for me). Testing this bugfix on XAMPP on Windows 8. The 1st level menu gets translated, but not the 2nd. Can we do something with it? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now