Soma Posted March 27, 2012 Share Posted March 27, 2012 Hey, I just installed my teflon admin template on a new project (latest PW). I have installed german in the admin. For some reason, mos/some of the translations doesn't take effect. For example the topnav stays english. If I take the default admin theme, it works. Now, one would think then it's a problem of my admin theme. BUT wait! When I copy the default.php and topnav.inc from the core theme to my theme it still doesn't work. Also I made it multilang a while ago and it was working until now. What could be the problem? Have you changed anything Ryan recently? EDIT: tried again, and copied the wire/templates-admin to my site folder and the topnav suddenly doesn't translate anymore. So I guess it's a bug with custom admin themes not being parsed right. Link to comment Share on other sites More sharing options...
vitor Posted March 27, 2012 Share Posted March 27, 2012 That's strange, I'm using your Theme with the latest version of ProcessWire, and it is working for me, for Portuguese. Just to be sure, did you changed the Language in you Profile / Language also, Soma? Link to comment Share on other sites More sharing options...
Soma Posted March 27, 2012 Author Share Posted March 27, 2012 Strange really. Yes I checked the language in the user. I defined the default to be german and uploaded german package. After that I created another one just to make sure. But the wierdest is it also doesn't work if I put the "real" admin templates in the site folder. Link to comment Share on other sites More sharing options...
vitor Posted March 27, 2012 Share Posted March 27, 2012 I'm lost here, can it be caused by the German translation files? Can you try using another language like Portuguese? http://processwire.c...rtuguese-pt-pt/ That's the one I'm using. EDIT: Nope, I've just downloaded the German language files and it is working ok for me, like I've said completely lost here. Link to comment Share on other sites More sharing options...
Soma Posted March 27, 2012 Author Share Posted March 27, 2012 ... maybe some server setting issue. I never got that problem, and this project is on a server I've never used. But definately doesn't work correctly... just the buttons and some texts, but not the topnav. Maybe something to do with the __FILE__ thingies. Link to comment Share on other sites More sharing options...
ryan Posted March 27, 2012 Share Posted March 27, 2012 The issue here is the textdomain, which is based on directory + file. Files in /wire/templates-admin/ have a different textdomain than files in /site/templates-admin/ (since 'wire' and 'site' are different dirs). You should be able to resolve it by specifying the textdomain as the second param to your __() calls: $textdomain = '/wire/templates-admin/default.php'; __('text to translate', $textdomain); I would probably set that $textdomain var at the top of your default.php and then send it as the second arg to all your __() calls. However, if you've got any text translations unique to your theme, you'll want to leave off that $textdomain argument. Link to comment Share on other sites More sharing options...
Soma Posted March 27, 2012 Author Share Posted March 27, 2012 Thanks ryan, thats useful to know, but why does it work in other installs... and servers. I updated my theme like this, so its working without changing something. Or am i wrong and missing something? *** Ok I think I'm getting old It is the same on my local test server. I'm confused as when I updated my theme with the language translation, it was working. Now it's only the topnav that isn't getting translated, but the other texts (buttons etc) work. Is it because of the inc of the topnav? and the __FILE__ that is there as the domain, and the translation was done on the /wire domain? SO I need to update my theme again. Thanks for the help Ryan. Link to comment Share on other sites More sharing options...
ryan Posted March 27, 2012 Share Posted March 27, 2012 Are you including /wire/templates-admin/topnav.inc or outputting your own top nav? If you are including it from /wire/ then the translations in there will still work. None of the other translations should pull over from the /wire/templates-admin/ textdomain, since your admin theme is asking for translations with a /site/templates-admin/default.php textdomain. If they were working before, they probably shouldn't have been But that's why I was wondering if you might be including the topnav file from /wire/templates-admin/topnav.inc? Link to comment Share on other sites More sharing options...
Soma Posted March 27, 2012 Author Share Posted March 27, 2012 No it's done exact same way as default. It includes topnav.inc from itself not wire. I'm even more confused now. Could you download my theme and test? https://github.com/somatonic/teflon-admin-theme-pw2 Link to comment Share on other sites More sharing options...
Soma Posted March 27, 2012 Author Share Posted March 27, 2012 Ok I think the answer is easy Uffff it's just that the language pack doesn't really translate the default.php theme template, just the /wire one... so when I create that It should work for the topnav too. And the other texts (edit, view... 404 etc )work because they don't have a domain applied? Is that correct? Link to comment Share on other sites More sharing options...
Soma Posted March 28, 2012 Author Share Posted March 28, 2012 Update: So there's a slight problem now with this, in that all language pack maybe missing this translation in case someone uses custom admin theme. THe topnav won't get translated if there's no translation added for /site/templates-admin/default.php. It can be created quickly, but if someone doesn't know the language it's a little difficult and cumbersome. Can we do something about it that will choose the /wire/templates-admin/default.php ? Or urge the language packes creator to have this included? Link to comment Share on other sites More sharing options...
ryan Posted March 28, 2012 Share Posted March 28, 2012 And the other texts (edit, view... 404 etc )work because they don't have a domain applied? Is that correct? Those work because they are coming from a different file. The only translations that won't come through to /site/templates-admin/default.php are those that are defined in /wire/templates-admin/default.php. The intended way to pull a translation from another textdomain is to specify that as the second param to the __() function, like this: __('logout', '/wire/templates-admin/default.php'); Rather than having to type that into every __() function call, I recommend just putting it in a variable at the top of your file: $td = '/wire/templates-admin/default.php'; And then just doing your calls like this: __('logout', $td); So if you were copying over the /wire/templates-admin/default.php into /site/templates-admin/default.php, then I would just change all the __('text', __FILE__); to __('text', $td); This is only worthwhile for instances where the untranslated text is going to be exactly the same between the one in /wire/ and the one in /site/. If you are adding new/different translatable text to your custom admin theme, then no need to have it reference PW's default admin theme, as that text won't be translated there. So for those instances, you would just do this: __('new text to translate'); __('new text to translate, __FILE__); // same thing: less pretty, slightly more efficient Link to comment Share on other sites More sharing options...
varvanin Posted April 13, 2012 Share Posted April 13, 2012 Tell me as a person not versed in programming to do it. You canfurther instructions? Where do I register textdomain? Link to comment Share on other sites More sharing options...
vitor Posted April 13, 2012 Share Posted April 13, 2012 Hello varvanin, Everything you need to know about Multi-Language Support is covered very well here: http://processwire.c...nguage-support/ it is a great read, please check it out, and if you still have doubts, post them here. Rest assure that you don't need any programming to do it Best 1 Link to comment Share on other sites More sharing options...
varvanin Posted April 13, 2012 Share Posted April 13, 2012 You do not understand me a little, I did not put no standard templatefor the administrator. Originally the original template, my native language (Russian) worked after installing the template extinct, not allof the administration panel. How do I fix this? Localizationdownloaded on this forum. And it worked. After installing the theme Futura Remixed not all translated. Sorry for bad English Link to comment Share on other sites More sharing options...
diogo Posted April 13, 2012 Share Posted April 13, 2012 Your English is not bad, it's just a bit glued Link to comment Share on other sites More sharing options...
ryan Posted April 13, 2012 Share Posted April 13, 2012 Varvanin, I'm not sure I understand all points, but if you switch to the default admin theme do you experience the same issue? I'm just wondering if it's something we need to look at in the Futura Remixed admin theme or somewhere else. Link to comment Share on other sites More sharing options...
varvanin Posted April 13, 2012 Share Posted April 13, 2012 On a standardtemplate, everything works fine.Tell mehow can Itranslatethese words in "Topnav.inc" if($showItem) { $class = strpos($page->path, $p->path) === 0 ? " class='selected'" : ''; $title = strip_tags((string)$p->get('title|name')); $title = __($title, dirname(__FILE__) . '/default.php'); echo "\n\t\t\t\t<li><a href='{$p->url}'$class>$title</a>"; if(count($p->children()) > 0 && $p->id != 3){ echo "<ul>"; echo "<span class='arrow'></span>"; foreach($p->children as $child){ if($child->viewable()) { $class = strpos($page->path, $child->path) === 0 ? " class='selected'" : ''; $child_title = strip_tags((string)$child->get('title|name')); $child_title = __($child_title, dirname(__FILE__) . '/default.php'); echo "\n\t\t\t\t<li><a href='{$child->url}'$class>$child_title</a></li>"; } } echo "</ul>"; } echo "</li>"; into my language. With other matters handled. How to translate $child variable? Link to comment Share on other sites More sharing options...
Soma Posted April 13, 2012 Author Share Posted April 13, 2012 varvanin, I think the $child_title is not translated because there's no translation for those subpages. I think one way would be to add translation in the default.php like it's done for the main admin pages: * __("Pages"); * __("Setup"); * __("Modules"); * __("Access"); * __("Admin"); So it can be added though the default.php, and the topnav.inc will get it from there. I don't know if there's another way. Ryan? Link to comment Share on other sites More sharing options...
Ralf Posted August 29, 2012 Share Posted August 29, 2012 @ soma i´m not 100% sure what about you talking but did that have something to do with your Template and this "translation"-bug?? How can i fix this?? Link to comment Share on other sites More sharing options...
Pete Posted August 29, 2012 Share Posted August 29, 2012 Don't think you can easily and that's why he's asking Ryan. Link to comment Share on other sites More sharing options...
ryan Posted August 29, 2012 Share Posted August 29, 2012 The phrases from that screenshot can be translated via these files: /wire/modules/Process/ProcessTemplate/ProcessTemplate.module /wire/modules/Process/ProcessField/ProcessField.module /wire/modules/Process/ProcessUser/ProcessUser.module /wire/modules/Process/ProcessRole/ProcessRole.module /wire/modules/Process/ProcessPermission/ProcessPermission.module Looks like I still need to make the "Languages" one translatable… ironic Link to comment Share on other sites More sharing options...
Soma Posted August 29, 2012 Author Share Posted August 29, 2012 I think for those menu subentries it would be easier to include them in the theme default.php, same like the top menu entries. So they can be translated from the same translation file for default.php. /* * Dynamic phrases that we want to be automatically translated * * These are in a comment so that they register with the parser, in place of the dynamic __() function calls with page titles. * * __("Pages"); * __("Setup"); * __("Modules"); * __("Access"); * __("Admin"); * Standard Submenus * __("Fields"); * __("Templates"); * __("Languages"); * __("Users"); * __("Roles"); * __("Permissions"); * */ 1 Link to comment Share on other sites More sharing options...
Ralf Posted August 29, 2012 Share Posted August 29, 2012 @ ryan i think this is in this special case not the point because all the translation are correct in these files... (see the attachment, in the side they are correct but not in the submenu). => the answer for this problem is the answer from Soma 7 minutes before Link to comment Share on other sites More sharing options...
Soma Posted August 29, 2012 Author Share Posted August 29, 2012 The phrases from that screenshot can be translated via these files: /wire/modules/Process/ProcessTemplate/ProcessTemplate.module /wire/modules/Process/ProcessField/ProcessField.module /wire/modules/Process/ProcessUser/ProcessUser.module /wire/modules/Process/ProcessRole/ProcessRole.module /wire/modules/Process/ProcessPermission/ProcessPermission.module Looks like I still need to make the "Languages" one translatable… ironic Would that also translate the navigation title? That would make 3 ways to make the same translateable. - through module - through admin theme default.php - through direct admin page title (if page title is changed to multi-language text field) It is also to consider that we discussed and decided that not every word and module will be translated which doesn't belong to normal editors. Lot's of modules core/third-party aren't translateable (yet) and adding modules (that will maybe also create admin pages) will have to be translated if you want to by the developer himself, unless the module developer serves his modules with translation files for every language, which will not happen anyway except the community cares to help to do so. 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