ASPX templates
Version 5.x > ASPX templates > how to realize the mutilingual fonction in a web part? View modes: 
User avatar
Member
Member
yuming.cai.eason-gmail - 9/1/2010 7:22:08 AM
   
how to realize the mutilingual fonction in a web part?
Hello, I am trying to develop a site with severals languages. But i've met a problem, how to translate the texts in the web parts? for instance, the texts in a Bizform or in an application wirtten by C#? Need i re-wirte the program or we can reach that with a better solution?

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 9/1/2010 7:41:07 AM
   
RE:how to realize the mutilingual fonction in a web part?
Hi,

you can use the localization expressions or add the strings to the resx file and then use the keys in the code behind using

string CMS.GlobalHelper.ResHelper.LocalizeString(string inputText)

Best regards,
Juraj Ondrus

User avatar
Member
Member
yuming.cai.eason-gmail - 9/1/2010 8:40:51 AM
   
RE:how to realize the mutilingual fonction in a web part?
I appreciate your response. But i am a green hand for KENTICO CMS. Accordings to your suggestion. I 've tried to modify the web part "NewBlog". What i want to do is to translate the label of it.
Ex. i want to translate "Blog name" to "Nom du Blog".
first of all, i tried opening the source codes of "NewBlog", and i found the Id of label is a value. so i looked for it in the file "CMSResources/CMS.resx".
I've modified the value of "blog.commentedit.lblname" with "{$=Name:|de-de=NameD:|fr-ch=NOM:$}"(the code accordings to Localization Expressions). But i cannot manage to reach my goal.
Please give me some helps and clews.
Thanks a lot

Best regards

User avatar
Member
Member
yuming.cai.eason-gmail - 9/1/2010 8:48:35 AM
   
RE:how to realize the mutilingual fonction in a web part?
yuming.cai.eason-gmail wrote: I appreciate your response. But i am a green hand for KENTICO CMS. Accordings to your suggestion. I 've tried to modify the web part "NewBlog". What i want to do is to translate the label of it.
Ex. i want to translate "Blog name" to "Nom du Blog".
first of all, i tried opening the source codes of "NewBlog", and i found the Id of label is a value. so i looked for it in the file "CMSResources/CMS.resx".
I've modified the value of "blog.commentedit.lblname" with "{$=Name:|de-de=NameD:|fr-ch=NOM:$}"(the code accordings to Localization Expressions). But i cannot manage to reach my goal.
Please give me some helps and clews.
Thanks a lot

Best regards





sorry, i've made a mistake.
I've modified the value of "blogs.newblog.name" with "{$=Name:|de-de=NameD:|fr-ch=NOM:$}"

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 9/1/2010 3:56:52 PM
   
RE:how to realize the mutilingual fonction in a web part?
Hi,

please take a look again at following part of documentation:
http://devnet.kentico.com/docs/devguide/configuring_multilingual_ui.htm

There is written how to Modify standard strings. In your case the standard string is blogs.newblog.name.

So you will need to copy cms.resx file into custom.xx-xx.resx file. So you will create two copies. The first one with name custom.fr-ch.resx and the second one with custom.de-de.resx name. Then you will need to find blogs.newblog.name in custom files and translate its value.

The restart of Kentico CMS application is needed after changing .resx files. Go to Site Manager - Administration - System and restart system.

Now standard string blogs.newblog.name should be translated.

Best regards,
Ivana Tomanickova

User avatar
Member
Member
yuming.cai.eason-gmail - 9/2/2010 1:30:35 AM
   
RE:how to realize the mutilingual fonction in a web part?
Hi,

Thank you very much for your solution, i managed to do that.

Best regards,

User avatar
Member
Member
yuming.cai.eason-gmail - 9/2/2010 4:34:45 AM
   
RE:how to realize the mutilingual fonction in a web part?
hi,
in another example.
User image
i cannot find the name "First Name" in the file "cms.resx".
In this case, i find a general problem, if i want to design a web part which can be modified by the users or i want to crearte a new web part on C#. how could i use the multiligual fonction.

In the first case, Bizform is a web part existing in kentico, different from the others, it can be designed by the users. so i couldn't find the values in cms.resx file.So is there a better way just like a shortcut to easily find them.

In the another case, The custome designed web part is written by C#. I have no idea to make it mutilingual. I've tried to 2 methods.
the First way is that i added le code
label1.text = CMS.GlobalHelper.ResHelper.LocalizeString("hello")
or
label1.text = CMS.GlobalHelper.ResHelper.LocalizeString("$ =hello|fr-ch=bonjour")
But as result, nothing has changed.
So i am entangled with this problem.
the second way, i've tried to find the value which i can change in the CMS.resx. But i cannot find anything. it's certainly, because it's written by me not exising in kentico.
So i added the values that i want to change into CMS.resx file. It didn't work yet.
Have any solution?

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 9/2/2010 7:24:31 AM
   
RE:how to realize the mutilingual function in a web part?
Hello,

In Biz Forms - selected_bizform - Fields is label of field stored in Field caption. So you can insert a macro inside:

{$my.multilingual.caption$}

Then in Site manager - Development - UI cultures you will need to create a New string with key my.multilingual.caption and insert a translation into Text part.

If you want to create your custom webpart you can again register a string in UI Cultures. In code behind you can display the text of your string using following method:

CMS.GlobalHelper.ResHelper.GetString("my.multilingual.caption");

You can find more information about localization macros here.

Best regards,
Ivana Tomanickova


User avatar
Member
Member
ravindra.chatterjee-tridecimal - 9/7/2010 5:41:26 AM
   
RE:how to realize the mutilingual fonction in a web part?
Hi,

Thanx for your support.

Now I am designing a Registration page with the help of registration webpart. where I want to use multilingual support for my users.

I am facing following problems:

1. On registration page label text is showing multi language support but when user is entering text still its entering text in default language which is English in my case.

2. I want to send a verification mail to user's mailbox after pressing the register button. I am doing this but my problem is I want to send the email in user's selected language. it is possible to do then how????

3. Most important I want to generate automatic userid & password. Then I want to send this information to user on his/her mailbox.

so in this regard i am not understanding where I have to change the code. in ASPX or is there any functionality provided by portal engine????


Please suggest some solution ASAP.



User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 9/8/2010 2:42:14 PM
   
RE:how to realize the mutilingual fonction in a web part?
Hi,

1. I am not sure if I understand your question. In Properties of webpart you can use localization macro instead of label text. Names of localization macros you can find in ~/CMSWebParts/Membership/Registration/RegistrationForm.ascx.cs file.
Example:
Instead of
First name text: First name:
you can use
{$Webparts_Membership_RegistrationForm.FirstName$}

2. Did you mean notification e-mail that registration was successful with user name and password?
If yes, you can modify Membership - Registration e-mail template in Site Manager - Development - E-mail templates and use custom localization macro inside.
Example:
Intead of
Thank you for registration.....
you can use
{$thank.you$}
and add this string to cms.resx file or custom.resx file as described in one of previous post.

3.Would you like random password to be generated during registration (user inserts only name and e-mail)?

If yes, you will need to customize this behavior and change Registration form webpart to generate password. How to modify webparts is described here:
http://devnet.kentico.com/docs/devguide/modifying_the_code_of_standard_web_parts.htm?zoom_highlightsub=webpart%2Bmodify

Best regards,
Ivana Tomanickova