opalepatrick Posted February 25, 2016 Share Posted February 25, 2016 I am doing a simple translate English to French for a contact form using the code internationalisation syntax. Your Name, Your Email, Your Comments. I have used: __("Your Email") for instance. Then I added French to languages under set-up>languages and added the template. The fields show up in English. I add some translations. Change the profile to French, view page, everything is still in English. Bear in mind this is the first time I have done this, what am I missing? Link to comment Share on other sites More sharing options...
Sergio Posted February 25, 2016 Share Posted February 25, 2016 Is French activated for this page? And also on Home > Settings ? Link to comment Share on other sites More sharing options...
marcus Posted February 25, 2016 Share Posted February 25, 2016 I am doing a simple translate English to French for a contact form using the code internationalisation syntax. Your Name, Your Email, Your Comments. I have used: __("Your Email") for instance. Then I added French to languages under set-up>languages and added the template. The fields show up in English. I add some translations. Change the profile to French, view page, everything is still in English. Bear in mind this is the first time I have done this, what am I missing? When you view/check your page frontend, are you still logged in? Try to view your page in another browser (or a private tab), where you can make sure that you aren't logged in (probably with a user whose language is set to English) Link to comment Share on other sites More sharing options...
opalepatrick Posted February 25, 2016 Author Share Posted February 25, 2016 Sérgio, On the settings for the page concerned /home/contact-2/ is default but French is /contact-2/ - Is this the problem? I have checked the settings for the page and the home page, Sérgio, and they are fine in the sense that they have the option for a French url if needed. I have also checked using Firefox, marcus, set to prefer French content and it still does not show anything in French. Link to comment Share on other sites More sharing options...
opalepatrick Posted February 26, 2016 Author Share Posted February 26, 2016 Still struggling with this. I have followed the video on code internationalisation step by step and cannot see that I have missed anything. The admin area seems to recognise the fields from the template as I added some translation for them after choosing the particular file. Other than the __("word") code is there anything else that needs to be on a page? Maybe doctype/header or something? This is typical code: <label class="inline"><?=__("Your Name")?></label> Link to comment Share on other sites More sharing options...
LostKobrakai Posted February 26, 2016 Share Posted February 26, 2016 You don't need anything extra. Just __(); and that's it. Also all of these calls need to be on a single line in the file, which no other multi-language __() call. Link to comment Share on other sites More sharing options...
tpr Posted February 26, 2016 Share Posted February 26, 2016 Don't you set user language in your code manually by any chance? Eg. $user->language = ...? Link to comment Share on other sites More sharing options...
opalepatrick Posted February 26, 2016 Author Share Posted February 26, 2016 Baffled then. As that is exactly the way it is, LostKobrakai. I haven't any language related code in my template, tpr, although I did have <html lang="en"> which I removed but no difference. Link to comment Share on other sites More sharing options...
tpr Posted February 26, 2016 Share Posted February 26, 2016 Just for testing, using _x() instead does make any difference? Link to comment Share on other sites More sharing options...
opalepatrick Posted February 27, 2016 Author Share Posted February 27, 2016 No it doesn't I am afraid, tpr. I am using v2.5.3 -- would that make a difference? Link to comment Share on other sites More sharing options...
tpr Posted February 27, 2016 Share Posted February 27, 2016 You could try upgrading to see if it helps, provided if you don't have to stick with that version for some reason (backup first). But imo string translation should work with 2.5, it was added in 2.2 as I know. Link to comment Share on other sites More sharing options...
opalepatrick Posted March 10, 2016 Author Share Posted March 10, 2016 OK, picking this up again after moving house. Apart from the home page, all the default urls in settings for each page look like /home/contact/ and the French has just /contact/ - This is the pw generated url above the input boxes. The user inputs are both the same as /contact - Is this correct? Link to comment Share on other sites More sharing options...
Sergio Posted March 10, 2016 Share Posted March 10, 2016 I think the best way to find out what's happening is to you to download a fresh copy of PW and install the Multi language Profile (using a new database, of course). So you can see how things are done there. You'll have 3 languages available, English (default), Finnish and German, you can delete one of them and have just two. Link to comment Share on other sites More sharing options...
opalepatrick Posted March 10, 2016 Author Share Posted March 10, 2016 Sérgio, that is a good idea because I am beating my head against a brick wall here. Link to comment Share on other sites More sharing options...
LostKobrakai Posted March 10, 2016 Share Posted March 10, 2016 Did you adjust the name fields for the homepage (root page)? Link to comment Share on other sites More sharing options...
opalepatrick Posted March 10, 2016 Author Share Posted March 10, 2016 No I did not LostKobrakai. Do you mean some relevant fields that I want to translate there as well for instance? Or am I missing the point? Link to comment Share on other sites More sharing options...
LostKobrakai Posted March 10, 2016 Share Posted March 10, 2016 You mentioned your pages having different urls, while having the same name supplied: /home/contact/ vs. /contact. The /home part is probably because of the name settings of the homepage. It lets you choose if you want all multilanguage pages to be under the same url or namespaced as /en/…, /es/… or whatever name you want to be there. Link to comment Share on other sites More sharing options...
opalepatrick Posted March 10, 2016 Author Share Posted March 10, 2016 Thanks LostKobrakai, that did it. I did not realise that I needed to set the French home url with a /fr and that automatically fed through to the subsidiary pages. Because the demo is based on a home page, there is no indication/clue to that. Thanks once again. 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