Jump to content

Recommended Posts

Posted

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?

Posted

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)

Posted

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.

Posted

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>
Posted

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.

Posted

Don't you set user language in your code manually by any chance? Eg. $user->language = ...?

Posted

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.

Posted

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.

  • 2 weeks later...
Posted

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?

Posted

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. :)

Posted

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.

Posted

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.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...