StrataFrame Forum

Localization

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

By Ivan George Borges - 11/9/2006

Hiya.

I'm getting the following when trying to localize a label control. I have embedded the exported XML files for the message store, but still looks like the key is being searched into the database. Before embedding, I've tried to deploy it via DDT, and the same was happening. a

LocalizationKeyNotFoundException
 The specified key [teste1] was not found within the localization database.
KeyNotFoundException
 The message key [teste1] could not be found in the localization data.

Source     : MicroFour StrataFrame Base

Stack Trace:
   at MicroFour.StrataFrame.UI.Localization.ThrowKeyNotFoundException(String Key)
   at MicroFour.StrataFrame.UI.Localization.GetKeyRowFromXml(String Key)
   at MicroFour.StrataFrame.UI.Localization.RetrieveTextValue(String TextValueKey)
   at MicroFour.StrataFrame.UI.Localization.SetLocalizationOnControl(ILocalizable ControlToSet)
   at MicroFour.StrataFrame.UI.Windows.Forms.Label.InitializeObject()
   at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.InitializeFormLoadObjects()
   at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   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)

Thanks for any help.

By Trent L. Taylor - 11/9/2006

Two things...first, what does your AppMain.vb file look like in the InitApplication method where you setup your Messaging... properties?

Where these lines exist...do you have any other lines of code?


MicroFour.StrataFrame.UI.Localization.MessageKeyType = MicroFour.StrataFrame.Messaging.MessageKeyDataType.XML
        MicroFour.StrataFrame.UI.Localization.MessageLocaleID = MicroFour.StrataFrame.UI.Localization.GetActiveLanguage("TestingDate")

Second, have you right-clicked on your localization files and made sure that they are embedded?

By Ivan George Borges - 11/9/2006

MicroFour.StrataFrame.UI.Localization.MessageKeyType = MicroFour.StrataFrame.Messaging.MessageKeyDataType.XML

This one I commented, as the help file states it's not necessary


MicroFour.StrataFrame.UI.Localization.MessageLocaleID = MicroFour.StrataFrame.UI.Localization.GetActiveLanguage("TestingDate")

This one is there, pointing to my project.

Second, have you right-clicked on your localization files and made sure that they are embedded?

I went and right-clicked it, but didn't know what to check to see if it is embedded in the context-menu. But in the Properties sheet, the "Build Action" is set top "Embedded Resource"

By Ivan George Borges - 11/9/2006

Could it be that my Messages table got a bit messed up?

By Trent L. Taylor - 11/9/2006

Try this just for grins...add this code to the InitApplication:

MicroFour.StrataFrame.UI.Localization.RegisterEmbeddedXmlFile(Reflection.Assembly.GetExecutingAssembly(),"Internal Path to the XML files")

By Trent L. Taylor - 11/9/2006

That file is the languages file...not the message file Smile  You can include them both.  What files do you have embedded?
By Ivan George Borges - 11/9/2006

Trent L. Taylor (11/09/2006)
Try this just for grins...add this code to the InitApplication:

Did it ... got this:

MicroFour.StrataFrame.UI.Localization.RegisterEmbeddedXmlFile(Reflection.Assembly.GetExecutingAssembly(),"Internal Path to the XML files")

ArgumentException
 The stream could not be evaluated because the resource could not be located.

Source     : MicroFour StrataFrame Base

Stack Trace:
   at MicroFour.StrataFrame.UI.Localization.CreateDataTableFromStream(Stream Input)
   at MicroFour.StrataFrame.UI.Localization.RegisterEmbeddedXmlFile(Assembly ContainingAssembly, String FullPath)
   at ProFilmeNET.AppMain.InitApplication(InitializingApplicationEventArgs e) in C:\ProFilme.NET\ClientDotNET\ProFilmeNETSolution\ProFilmeNET\AppMain.vb:line 181
   at MicroFour.StrataFrame.Application.StrataFrameApplication.Raise_InitializingApplication(InitializingApplicationEventArgs e)
   at MicroFour.StrataFrame.Application.StrataFrameApplication.RunApplication()
   at ProFilmeNET.AppMain.Main() in C:\ProFilme.NET\ClientDotNET\ProFilmeNETSolution\ProFilmeNET\AppMain.vb:line 22
   at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

By Ivan George Borges - 11/9/2006

Something must have gone wrong, because I have made this work in the past.
By Trent L. Taylor - 11/9/2006

You have to replace the second parm to the path where your XML files are embedded.
By Ivan George Borges - 11/9/2006

Is there a size limit for the path ?

MicroFour.StrataFrame.UI.Localization.RegisterEmbeddedXmlFile(Reflection.Assembly.GetExecutingAssembly(), "C:\ProFilme.NET\ClientDotNET\ProFilmeNETSolution\ProFilmeNET\Localization Files\Message_Languages.xml")

MicroFour.StrataFrame.UI.Localization.RegisterEmbeddedXmlFile(Reflection.Assembly.GetExecutingAssembly(), "C:\ProFilme.NET\ClientDotNET\ProFilmeNETSolution\ProFilmeNET\Localization Files\Messages_1046.xml")

By Ivan George Borges - 11/9/2006

Trent L. Taylor (11/09/2006)
You have to replace the second parm to the path where your XML files are embedded.

I did it.

By Trent L. Taylor - 11/9/2006

Oh...this is your problem here...it is expecting the internal path to the XML files... how it is referenced within the assembly.

This command should give you an array with all of your resource names as they appear within the assembly:

Reflection.Assembly.GetExecutingAssembly.GetManifestResourceNames()

Find the name of your localization files in there and then replace your paths.

By Ivan George Borges - 11/9/2006

Blush Sorry for the trouble Trent. I thought it was the address.

Now it worked fine! But only the labels.

I'm trying to send a localized message for deletion, for example. So I created a message key in the Common Repository and set the AutoDeleteMessageKey to it. This one isn't showing up.

By Trent L. Taylor - 11/9/2006

Is it not in the XML file that was created?  If not, I will have to take a look at the common repository.  You do have your project including the repository...correct?

Please let me know if the repository items are not showing up and I will get it fixed for you Wink

By Ivan George Borges - 11/9/2006

No, it is there, I open the .XML file and the message is there.
By Trent L. Taylor - 11/9/2006

So did you set the message to use on the form?  You have to set the AutoDeleteMessageKey on the SF form...which from the sounds of it, you have already done....correct?  To check and see if it is still using the AutoDeleteTitle property instead of the key, change the AutoDeleteTitle property to "Testing" ... you should never see testing....it should show the AutoDeleteMessageKey message.
By Ivan George Borges - 11/9/2006

So did you set the message to use on the form?  You have to set the AutoDeleteMessageKey on the SF form...which from the sounds of it, you have already done....correct?

Correct.

To check and see if it is still using the AutoDeleteTitle property instead of the key, change the AutoDeleteTitle property to "Testing" ... you should never see testing....it should show the AutoDeleteMessageKey message.

Did it. It shows "Testing".

By Trent L. Taylor - 11/9/2006

OK....I will have to look into this then.  Thanks for the info.
By Ivan George Borges - 11/9/2006

Thank you, Trent.

And don't worry, we know it's Ben's fault.

By Trent L. Taylor - 11/9/2006

BigGrin Well at least you guys are learning BigGrin
By Ivan George Borges - 11/9/2006

Hi Trent.

I found out what Ben did ... BigGrinTongue

I was using a "Message" key, where it should be a "Text Value" key.

But one thing I still think is funny, when you have a Common Repository, the XML generated gets a bit mixed up. But I might find another Ben's mistake here ... hauhauhauhauhauhauhauhauhauha

By Trent L. Taylor - 11/9/2006

Well...it is important that you keep Ben in line...(even though I wrote that editor...he must have gone in and put in a gremlin or two ha ha Tongue )

He'll be back in the office on Monday so I will have to quit blaming him BigGrin