This is a migrated thread and some comments may be shown as answers.

Localization of RadSpell not working

7 Answers 129 Views
Spell
This is a migrated thread and some comments may be shown as answers.
Michael Evans
Top achievements
Rank 1
Michael Evans asked on 13 Jan 2011, 10:34 PM
I have a spell checker that I am trying to localize (both the UI and the dictionary language).  It's being called from a Silverlight application using Javascript.  That part works fine.  However, it never takes any of the language parameters I set; it always displays in English.

Here is the Javascript:

    <div>
<telerik:RadSpell ID="RadSpell1" runat="server" ClientTextSource="_variableSpellSource" ButtonType="None" Overlay="true"
    IsClientID="True" OnClientDialogClosed="spellingfinished"
    SupportedLanguages="en-US,English,fr-FR,French" />
    </div>
<script type="text/javascript">
    // Called from silverlight to check text from Silverlight
    function CheckSpelling(text, lang) {
        _variableSpellSource.set_text(text);
        var rs = GetRadSpell('<%= RadSpell1.ClientID %>');
        rs.Language = lang;
        rs.DictionaryLanguage = lang;
        rs.startSpellCheck();
    }
 
    // Calls silverlight back when spell check is done
    function spellingfinished(sender, e) {
        document.getElementById("silverlightControl").Content.Page.SpellCheckDone(_variableSpellSource.get_text());
        _variableSpellSource.set_text("");
    }
 
    var _variableSpellSource = new VariableSpellSource(); //object used in custom spell method (so I dont have to put text into a DOM object)
    var _defaultPageSpellText = ""; // The text to spell check
     
    // Class to allow custom spelling source
    function VariableSpellSource() {
        this.get_text = function() {
        return _defaultPageSpellText;
        }
 
        this.set_text = function(newValue) {
        _defaultPageSpellText = newValue;
        }
    }
</script>

I'm not sure what to do.  I even set Language and DictionaryLanguage hard-coded to "fr-FR" in the <telerik:RadSpell> object and it still shows in English.  Do I have something set up wrong elsewhere?  I have in my App_Data directory a RadSpell folder which contains de-DE.tdf, en-US.tdf, and fr-FR.tdf.

7 Answers, 1 is accepted

Sort by
0
Lini
Telerik team
answered on 14 Jan 2011, 02:49 PM
Hello,

Take a look at the following example, which shows how to localize the spell dialog - http://demos.telerik.com/aspnet-ajax/spell/examples/localization/defaultcs.aspx.

You need to set the Language property of the RadSpell control to the "fr-FR" if you want the labels in the dialog to be in French. You also need to have the spell localization files - RadSpell.Dialog.resx, RadSpell.Dialog.fr-FR.resx, and RadSpell.Dialog.de-DE.resx in the App_GlobalResources folder in your web  application. These files contain the labels for the spell dialog. The *.tdf files you have in App_Data/RadSpell/ contain only the dictionary languages.

All the best,
Lini
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Michael Evans
Top achievements
Rank 1
answered on 14 Jan 2011, 03:31 PM
OK, I didn't have the spell localization files in there.  However, I did add them to the project and I'm still only seeing English text.  Using Javascript's alert(), I've verified that the Language property of the RadSpell control is fr-FR.

I have the localization and dictionary files set to Build Action = Content, Copy To Output Directory = Copy if newer... is this correct?
0
Lini
Telerik team
answered on 18 Jan 2011, 10:49 AM
Hi,

If you are deploying the site to a different location, please make sure that the RadSpell files are copied as well - open the deployed location and check for the resource files under /App_GlobalResources/ and dictionary files under /App_Data/RadSpell/ . If you set the build action correctly, they should be copied, but you should double check to be sure. You can also see if the application works locally (e.g. without deploying).

The RadSpell control's Language property controls only the localization of the labels in the spell dialog. The DictionaryLanguage or SupportedLanguages properties specify the dictionary which will be used to check the text.

If the above suggestions do not work, please open a formal support ticket and send us your application, so we can test it locally and identify the problem.

All the best,
Lini
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Michael Evans
Top achievements
Rank 1
answered on 18 Jan 2011, 02:11 PM
I'm not sure what I did differently but now if I put the Language and DictionaryLanguage in the tag for the control, it shows up in the correct language.  However it's still not working via Javascript.  Here is the relevant code:

<telerik:RadSpell ID="RadSpell1" runat="server" ClientTextSource="_variableSpellSource" 
            ButtonType="None" Overlay="true" Language="fr-FR" DictionaryLanguage="fr-FR"
    IsClientID="True" OnClientDialogClosed="spellingfinished" 
    SupportedLanguages="en-US,English,fr-FR,French" Skin="Vista" />
    </div>
<script type="text/javascript">
    // Called from silverlight to check text from Silverlight
    function CheckSpelling(text, lang) {
        _variableSpellSource.set_text(text);
        var rs = GetRadSpell('<%= RadSpell1.ClientID %>');
        if (lang == 'en') { lang = 'en-US'; }
        if (lang == 'fr') { lang = 'fr-FR'; }
        if (lang == 'de') { lang = 'de-DE'; }
        rs.Language = lang;
        rs.DictionaryLanguage = lang;
        rs.startSpellCheck();
    }

Obviously the startSpellCheck() is working, so the reference to the object is valid.  The files are all there because it works when I set the language to "fr-FR" in the tag (as shown above).  I have verified that "lang" is the correct value. What else could I be doing wrong?
0
Lini
Telerik team
answered on 19 Jan 2011, 01:25 PM
Hi,

Since this forum is for the ASP.NET AJAX version of RadSpell, I am going to assume that you are not using the old (classic ASP.NET) RadSpell. If this is the case, you need to use the ASP.NET AJAX naming convention for setting properties using JavaScript. Change

rs.Language = lang;
rs.DictionaryLanguage = lang;

to

rs.set_language(lang);
rs.set_dictionaryLanguage(lang);

For more information, you can refer to the client-side programming section for RadSpell in our documentation - http://www.telerik.com/help/aspnet-ajax/spell_clientbasics.html

All the best,
Lini
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Michael Evans
Top achievements
Rank 1
answered on 19 Jan 2011, 02:50 PM
Well, that's got it halfway there.  Calling set_dictionaryLanguage(lang) works to change the dictionary language.  However, calling set_language(lang) apparently causes a Javascript error because the dialog does not come up at all.

I looked at this page: http://www.telerik.com/help/aspnet-ajax/spell_clientapi.html and it didn't include the function set_language().  There was a get_selectedLanguage() which seemed to work but there wasn't a set_selectedLanguage().  I couldn't find any other properties relating to the language.
0
Lini
Telerik team
answered on 21 Jan 2011, 03:56 PM
Hello,

I talked to a developer and he told me that it is not possible to set the language of the spell dialog using JavaScript. Only the server-side Language property will be respected. Once a language for the dialog labels has been set on the server, it is encoded and sent to the dialog along with the rest of the dialog parameters directly so it cannot be modified later in the browser. The only dialog parameter that you can set is the dictionary language. I am sorry that I was not able to help you with this issue.

If you want to have different languages for the labels in the spell dialog, you can try to detect the browser culture on the server and use that for the spell dialog.

Regards,
Lini
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Spell
Asked by
Michael Evans
Top achievements
Rank 1
Answers by
Lini
Telerik team
Michael Evans
Top achievements
Rank 1
Share this question
or