Soma Posted January 27, 2012 Share Posted January 27, 2012 I'm trying to get the a translation to work in the search result template. I got this: $searchresult_out .= sprintf(_n("Found %d page matching your query:", "Found %d pages matching your query:", $searchresult_count), $searchresult_count); And it doesn't show up in the translation edit page. Any ideas? Link to comment Share on other sites More sharing options...
ryan Posted January 27, 2012 Share Posted January 27, 2012 You've found a bug. Try putting a space before your '_n' ( and that'll fix it. I should have a proper fix committed here in a couple minutes. Thanks for finding this. Ryan Link to comment Share on other sites More sharing options...
Soma Posted January 27, 2012 Author Share Posted January 27, 2012 Ah ok, thanks Ryan, now it works this way. Just got some OT question. 1. When installed there's the default language, which is english. When I create a new language let's say german I would name it "de" so I can use it for front-end translation and user/guest language as the url segment /de/somepage. I most of the time use it like this and in the page tree I create /de/ and /en/ for the language pages. Now I recognized that I can't change the name "default" to like "en". Edit: Damn! What was I thinking... meh... thinking more about it , it makes sense to have "default" as a constant, as otherwise one wouldn't be able to know what the default language name would be . And for using it in a multilang setup it's just a matter of checking for "default" and set the language path segement to "de" or "en" as the global front end lang var. 2. And another one is I just question myself, what do I do when I want to specify german as default? Ok I guess I can drop the german language json package into the default. And then? Create an english language package for the english version? Link to comment Share on other sites More sharing options...
ryan Posted January 27, 2012 Share Posted January 27, 2012 Soma, sounds like you've got it right. If you want the default language to be German, then just throw in the German files into the default language. There's nothing English about the default language except for the name "default" (which you uncovered the reasons for). But if you want to connect the language to a code like "de", then I suggest creating a new field called language_code and adding it to the language template. When you want to select a language, just use "language_code=de" in your selector. When you create your English language as an alternate, you won't need to upload any JSON files for the admin side of PW unless you want to change the English that is already there. I don't think there's any reason to gravitate towards keeping 'default' as English, unless it really is your site's default language. But if you want to do that for some reason, then you would just edit the 'guest' user account and change guest's language to to be 'de' or whatever you want your site's default language to be. 2 Link to comment Share on other sites More sharing options...
Arklogic Posted January 11, 2015 Share Posted January 11, 2015 I don't think there's any reason to gravitate towards keeping 'default' as English, unless it really is your site's default language. But if you want to do that for some reason, then you would just edit the 'guest' user account and change guest's language to to be 'de' or whatever you want your site's default language to be. Ryan, despite of I've changed the guest user language to Hungarian, the English site loads by default. I've all the necessary translataions, I don't know how could I change the default lang to Hungarian. I need this on the public site, in admin the correct lang is loaded I've set for the admin user. 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