StrataFrame Forum

Localization builtin texts

http://forum.strataframe.net/Topic15011.aspx

By Jiri Brazda - 3/19/2008

Hi,

I'm trying the trial version and have found that I'm unable to change some texts. For example I need to completely translate MaintenanceFormToolStrip control. I'm able to change button texts and tooltips but I do not know how to translate confirmation box when deleting record ("Are You sure you wish to delete..." etc.).

Can anybody give me an answer please?

Thanks

George

By Trent L. Taylor - 3/19/2008

There is a property on the form called AutoDeleteMessage which you can change on the form.  You could also create a localization key and set teh AutoDeleteMessageKey property which will then pull from the localization table instead.

By Jiri Brazda - 3/19/2008

Hi,

Thank You for Your answer. It works fine. However I do not know how to translate simple texts like "Yes" and "No" included in the quetions. I haven't found it neither on the control or on the form.

Additionally - I would like to ask, what is the best supported method to use localized texts in my application to avoid rewriting texts in each control and form. I'm using a template empty form and control that all of forms and controls inherits and all common settings are implemented in this template form/control. Would You suggest any better method?

Thank You

George

By Ivan George Borges - 3/20/2008

Hi George.

There is a whole module that will deal with localization for you. Just for a start, and we can carry on from here, have a look at the StrataFrame menu on Visual Studio, and you will find a "Localization & Messaging Editor". Then, open the SF Help and go to "Application Framework" / "Localization & Messaging".

Within this project, you will define text and messages, with their keys, and use and re-use them troughout your application, in many languages you wish for.

And just to remind you, if you can, there is a class coming up in July where the guys go through this extensively. You would benefit a lot attending theses classes.

Cheers.

By Jiri Brazda - 3/20/2008

Hi Ivan,

thank You for Your assistence. I have already examined the functionality of Localization and messaging editor. When building multilanguage applications it is really very usefull featur.

However this is not exactly what I have asked. For the moment I do not know, how to translate some common texts like "Yes" and "No" in AutoDelete dialog (for exmaple). I have succesfully translated AutoDeleteTitle etc., but I cannot find where I can set proper text for translation of buttons caption (Yes/No).

The second part of the question was aimed to the best approach for using multiple forms and controls in application. Disregarding of whether I use Localization and Messaging editor or update texts manually, I have to set proper texts (or corresponding keys) on each new form. And to avoid this I have mentioned that I'm always using empty template form where I set all common properties (not only texts but fonts, colors etc) in this parent form and all forms in the application inherits this template form. The question was then simple - is this good approach or You can recommend me some better way how to work with StrataFrame?

Thank You

George

By Trent L. Taylor - 3/20/2008

However this is not exactly what I have asked. For the moment I do not know, how to translate some common texts like "Yes" and "No" in AutoDelete dialog (for exmaple). I have succesfully translated AutoDeleteTitle etc., but I cannot find where I can set proper text for translation of buttons caption (Yes/No).

Actually Ivan was giving you the answer.  The Yes, No, cancel, etc can be controlled through the Localization and Messaging editor.  Apparently you are trying to use a language that has not already been pre-localized by StrataFrame.  If you open the Localization and Messaging Editor, create a project, you can set the Yes, No, Cancel, etc. in the properties of the language.

And to avoid this I have mentioned that I'm always using empty template form where I set all common properties (not only texts but fonts, colors etc) in this parent form and all forms in the application inherits this template form. The question was then simple - is this good approach or You can recommend me some better way how to work with StrataFrame?

Simply using inheritance would resolve this.  Create a base form that inherited from the StrataFrame BaseForm, set all of the properties for fonts, localization keys, etc.  Then create your own template (or manually change the inheritance) of all of the forms that you create.  This way you only program this logic once.

By Jiri Brazda - 3/20/2008

I have followed Your instructions and have performed the following actions:

- have created new Messaging project

- added new language (Czech)

- set localized texts for common translations as You described in previous post

- generated XML (I have tried to generate only XML for Czech republic but when I have examined the generated file, there were no texts; then I have generated document for all languages - in this document there are all localized texts)

- imported these files in Visual Studio and set these files as Embeded resources)

- in InitApplication shared method I have added the line "Localization.MessageLocaleID = 1029"

- in menu StrataFrame - Solution Preferences I have selected my project and default language set to Czech in Localization preferences

However - there are still "Yes" and "No" text in the running application. I really do not know what else should I do to see texts in my language. I have searched the help file but haven't found solution :-(.

Please help

Thank You

By Trent L. Taylor - 3/21/2008

in menu StrataFrame - Solution Preferences I have selected my project and default language set to Czech in Localization preferences

This has nothing to do with the run-time of the application.  This is so you can create localization keys through the designer without having to go over to the Localization window.

However - there are still "Yes" and "No" text in the running application. I really do not know what else should I do to see texts in my language. I have searched the help file but haven't found solution :-(.

Now that I know what language you are trying to use, would you like for me to send you the translation tables for all of the pre-localized StrataFrame components?  This way it will be part of the framework (including teh Yes/No) and you will not have to do this manually.  We have a translation tool that will allow you to translate all of the keys.  There are 4 translation packages (some only have a 5-10 keys).  The largest package is Security which has 279 keys.  But by doing this it will make it easier on you in this area and all run-time components will be translated for you and you will not have to worry with the SF messages anymore, just the ones for your application.

By softaca - 3/21/2008

Hi Trend

If you send me this translation tool i could make the Dutch translation for the framework. I already did in my projects.

Ruud Stumpel

By Trent L. Taylor - 3/21/2008

Ruud,

I have sent you the Dutch packages...let me know if you get these.  Thanks!

By Jiri Brazda - 3/21/2008

I'm just evaluating Your framework and the only thing I need at the moment is to have all texts in my application in Czech. I have prepared a few custom texts and these are localized properly using embeded resource option. Is there any simple way how to translate 5 builtin texts? I do not want to specify anything else. I hope that when I need to localize five simple words, it is not necessary to build it into core of Your framework.

As I have said, I'm just evaluating the framework. In case that I buy it and start to use it, I would definitely cooperate with You on Czech localization.

But for now I need to have my test application completely translated without any other issues. Is it possible, please?

If You can show me a simple piece of code that demonstrates how to do it, here are the czech translations Yes = Ano, No = Ne.

By Jiri Brazda - 3/21/2008

Additionally I'm posting my Message_Languages.xml:

<?xml version="1.0" standalone="yes"?>

<NewDataSet>

<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">

<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="MessageLanguages" msdata:UseCurrentLocale="true">

<xs:complexType>

<xs:choice minOccurs="0" maxOccurs="unbounded">

<xs:element name="MessageLanguages">

<xs:complexType>

<xs:sequence>

<xs:element name="lng_pk" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" type="xs:int" minOccurs="0" />

<xs:element name="lng_prj_pk" type="xs:int" minOccurs="0" />

<xs:element name="lng_codepage" type="xs:int" minOccurs="0" />

<xs:element name="lng_isolanguage" type="xs:string" minOccurs="0" />

<xs:element name="lng_yes" type="xs:string" minOccurs="0" />

<xs:element name="lng_no" type="xs:string" minOccurs="0" />

<xs:element name="lng_retry" type="xs:string" minOccurs="0" />

<xs:element name="lng_cancel" type="xs:string" minOccurs="0" />

<xs:element name="lng_EventId" type="xs:string" minOccurs="0" />

<xs:element name="lng_baselanguage" type="xs:boolean" minOccurs="0" />

<xs:element name="lng_created" type="xs:dateTime" minOccurs="0" />

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:choice>

</xs:complexType>

</xs:element>

</xs:schema>

<MessageLanguages>

<lng_pk>6</lng_pk>

<lng_prj_pk>3</lng_prj_pk>

<lng_codepage>1029</lng_codepage>

<lng_isolanguage>ces</lng_isolanguage>

<lng_yes>Ano</lng_yes>

<lng_no>Ne</lng_no>

<lng_retry>Znovu</lng_retry>

<lng_cancel>Zruçit</lng_cancel>

<lng_EventId>¬ˇslo ud losti</lng_EventId>

<lng_baselanguage>true</lng_baselanguage>

<lng_created>2008-03-21T07:51:15.653+01:00</lng_created>

</MessageLanguages>

<MessageLanguages>

<lng_pk>4</lng_pk>

<lng_prj_pk>3</lng_prj_pk>

<lng_codepage>1033</lng_codepage>

<lng_isolanguage>eng</lng_isolanguage>

<lng_yes>Yes</lng_yes>

<lng_no>No</lng_no>

<lng_retry>Retry</lng_retry>

<lng_cancel>Cancel</lng_cancel>

<lng_EventId>Event ID</lng_EventId>

<lng_baselanguage>true</lng_baselanguage>

<lng_created>2008-03-20T16:50:03.487+01:00</lng_created>

</MessageLanguages>

</NewDataSet>

By Ivan George Borges - 3/22/2008

Hi George.

Having a nice weekend? Wink

I have changed my Messaging Project to show Ano/Ne for Yes/No, which in my case (Portuguese), would be Sim/Não.

So, I'm attaching some pictures with the steps I did to accomplish this. As I was trying to tell you before, this all went through the Localization & Messaging Editor.

So, once you open the Localization and Messaging Editor, you go for the File Menu and choose Open Project. You will get the following screen, click on your project and choose Edit.

Within my project, I will choose my language (Portuguese (Brazil), you would probably have added yours), and go for Edit again.

Notice in the following picture, that I have changed my Yes/No strings into Ano/Ne:

And this is one of my application's simple form, I made some changes and click the Close button, which brought the "Want to Save?" question. Have a look at the Yes/No buttons with Ano/Ne translations:

Hope it helps.

Have a nice Easter! Cool

By Jiri Brazda - 3/25/2008

Hi Ivan,

thank You for Your help and patience. I have followed the steps You have described in Your post (I did the same before). However - I haven't got the result as You have got on the last picture. It seems to me that there is something wrong in my application an not in my localization project. I have created simple application where I have included the "Message_Languages.xml" file generated by LME. It is included in the attachment of this post.

It seems to me that this file is completely ignored by application because when I change English texts to some mindless texts ("AAA", "BBB", etc.) the application still uses "Yes", "No", etc.

I'm really confused by this and I'm so sorry for disturbing You :-(

By Ivan George Borges - 3/25/2008

Hey George!

I have downloaded your sample and here are some things we could start working on:

Your Message_Languages.xml is not embedded within your application. You could go this way, but it is recommended to use an embedded Message Store.

Please, to help you get the idea, have a look at the help file under "Application Framework" / "Localization & Messaging Editor" / "Messaging" / "Configuring the Message Store" and also "Localization"

Looking at you AppMain.vb, I can see you have set the MessageLocaleID to 1029, which is fine. But you haven't set up your Message Store, which will be required in case you don't embed it into your application.

See if you make progress and then let me know if we need to work some more steps together.

Cheers. Wink

 

By Jiri Brazda - 3/25/2008

Hi Ivan,

I have missed to set the language xml file in my sample application but even when I set it there was no change. However I have made some progress:

- I have tried to call "ShowAvailableLanguages" method in InitApplication - and when running my application there occurred the foolowing error:

FileNotFoundException
  The file [Message_Languages.xml] could not be found.  The localization languages table could not be loaded.

Source     : MicroFour StrataFrame Base

Stack Trace:
   at MicroFour.StrataFrame.UI.Localization.LoadLanguageTable(Boolean IgnoreExceptions)
   at MicroFour.StrataFrame.UI.Localization.GetLanguagesFromXml()
   at MicroFour.StrataFrame.UI.Localization.GetAllAvailableLanguagesFromData()
   at MicroFour.StrataFrame.UI.LanguageSelectionDialog.LoadLanguages()
   at MicroFour.StrataFrame.UI.LanguageSelectionDialog..ctor(String ApplicationKey, String UserName)
   at MicroFour.StrataFrame.UI.Localization.ShowAvailableLanguages(String ApplicationKey, String UserName)
   at MicroFour.StrataFrame.UI.Localization.ShowAvailableLanguages()
   at LocalizationSample.Form1.ChooseLanguage()
   at LocalizationSample.Form1.LinkLabel1_LinkClicked(Object sender, LinkLabelLinkClickedEventArgs e)
   at System.Windows.Forms.LinkLabel.OnLinkClicked(LinkLabelLinkClickedEventArgs e)
   at System.Windows.Forms.LinkLabel.OnMouseUp(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Label.WndProc(Message& m)
   at System.Windows.Forms.LinkLabel.WndProc(Message& msg)
   at System.Windows.Forms.Control.ControlNativewindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativewindow.WndProc(Message& m)
   at System.Windows.Forms.Nativewindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

- Additionally I have tried to run Your sampla application from "Sample Console" called "BasicLocalizationImplementation" - and when clicking "Change Language" link the exactly same error has occurred.

So I suspect that there is nothing to do with my application but the operating system environment. I'm running Windows Vista Business EN SP1 and Visual Studio 2005 Professional.

Do You have any idea what could be the problem?

Thanks a lot

By Trent L. Taylor - 3/26/2008

I have tried to call "ShowAvailableLanguages" method in InitApplication - and when running my application there occurred the foolowing error:

Yes...the Message_Languages file cannot be found.  When you call the ShowAvailableLanguages, it looks for the Message_Languages.xml file.  If this file is NOT embedded, then you MUST specify the location of the external XML files (either all XML files have to be external or embedded, you cannot mix the two).  You specify the XML file location in the AppMain.vb or program.cs file in the InitApplication method or whereever you are setting the LocaleID.  The property would be the MessagingXMLPath property.

By Jiri Brazda - 3/26/2008

Ok, so I'm going to breifly specify what is working on my computer and what not:

- When I specify MessageKeyType and MessageXMLPath, it works fine, everything is localized properly (even Yes and No texts); however I would like to use Your recommended way (embedded resource) to distribute languages with my application (especially when I would like to have only one...)

- When I do not specify MessageKeyType and MessageXMLPath (for using embedded language files), it never works - disregarding wherher I set language files as Embedde Resource or not

- Finally - as I have mentioned in my previous post - when I try to run Your Sample application (deployed during installation of Your framework) I receive the same error stating that the Message_Languages.xml could not be found. And this is why it seems to me that the problem doesn't come from mz development project but from somewhere else on my computer, since I receive this error when running sample aplication compilled by You...

By Ivan George Borges - 3/26/2008

OK. Make sure it is embedded on its property window. Also, try putting this line of code in your AppMain.vb's InitApplication: 

MicroFour.StrataFrame.UI.Localization.RegisterEmbeddedXmlFile(Reflection.Assembly.GetExecutingAssembly(), "YourNameSpace.Message_Languages.xml")

By Trent L. Taylor - 3/26/2008

Ivan's post will fix your problem.  I have also made a change to the framework to do a more exhaustive search.  You can get it here: http://forum.strataframe.net/FindPost15182.aspx .
By Jiri Brazda - 3/26/2008

BINGO!!!

Adding this row has really fixed this problem. I'm going to test the fix posted by Trent.

Ivan, Trent - thanks a lot for Your help!!!

By Ivan George Borges - 3/26/2008

Glad you got it going, George! Cool
By Jiri Brazda - 4/25/2008

Jiri Brazda (03/21/2008)
I'm just evaluating Your framework and the only thing I need at the moment is to have all texts in my application in Czech. I have prepared a few custom texts and these are localized properly using embedded resource option. Is there any simple way how to translate 5 builtin texts? I do not want to specify anything else. I hope that when I need to localize five simple words, it is not necessary to build it into core of Your framework.

As I have said, I'm just evaluating the framework. In case that I buy it and start to use it, I would definitely cooperate with You on Czech localization.

But for now I need to have my test application completely translated without any other issues. Is it possible, please?

If You can show me a simple piece of code that demonstrates how to do it, here are the czech translations Yes = Ano, No = Ne.

Hi Trent,

could You send me translation tables - I would like to translate it in Czech and send it to You to include Czech language as one of run-time languages.

Thank You

By Trent L. Taylor - 4/27/2008

Jiri,

I would be happy to send these your way.  If you don't get them by the end of the day Monday, shoot me an email and remind me.  Thanks!