By Peter Denton - 6/11/2007
G'dayI'm working on developing a system that will be sold overseas, potentially into countries where english is not the main language. It also deals with an industry where local nomenclature can be very different, and we believe it is important that the end-user is able to customise the terms used in the system (ie Localisation text values and messages) to match their usage. For this reason we have decided to use the application's database to hold the Localisation Tables. I've written an editor that alows the text values and messages to be edited from there, however I'm having a slight problem with the messages. When I change one of the parameters of a message I can see that my editor saves that change to the database, but when I try to test the message as follows I don't get what I expect: Private Sub btnMessageItemTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMessageItemTest.Click If Me.PrimaryBusinessObject.IsDirty Then Me.PrimaryBusinessObject.Save() End If MessageForm.ShowMessageByKey(BoMessageItemMessage1.msg_key, "P0", "P1", "P2", "P3", "P4", "P5", "P6", "P7", "P8", "P9", "P10", "P11", "P12", "P13", "P14", "P15", "P16", "P17", "P18", "P19", "P20") ' Back into editing mode Me.Edit() End Sub I get a dialog displayed, but the most recent change (or in fact any since the editor was opened) is not reflected. Is there a cache of the messages that I need to refresh somehow, or have I got something a little (or totally) confused? I have the MessageLanguages and MessageItems tables in the application database (Unchanged from the definition in the Strataframe database, except for the addition of defaults on some columns). Any advice greatly appreciated. Peter
|
By Peter Denton - 6/11/2007
G'day again,I just realised that I need to change language to that of the Message I'm attempting to test. It's not the solution to my problem and my attempt to change language doesn't work properly either, but the code snippet should look more like this: Private Sub btnMessageItemTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMessageItemTest.Click ' Save Bo if necessary If Me.PrimaryBusinessObject.IsDirty Then Me.PrimaryBusinessObject.Save() End If ' Change language to that used by the current "Message", test "Message", and put language back how it was. Dim my_lang As Integer = MicroFour.StrataFrame.UI.Localization.GetActiveLanguage() MicroFour.StrataFrame.UI.Localization.SetActiveLanguage(MicroFour.StrataFrame.Data.ConnectionManager.ApplicationKey, CType(BoMessageItemMessage1.msg_language, Integer)) MicroFour.StrataFrame.UI.Localization.WriteApplicationDataToDisk() MessageForm.ShowMessageByKey(BoMessageItemMessage1.msg_key, "P0", "P1", "P2", "P3", "P4", "P5", "P6", "P7", "P8", "P9", "P10", "P11", "P12", "P13", "P14", "P15", "P16", "P17", "P18", "P19", "P20") MicroFour.StrataFrame.UI.Localization.SetActiveLanguage(MicroFour.StrataFrame.Data.ConnectionManager.ApplicationKey, my_lang) MicroFour.StrataFrame.UI.Localization.WriteApplicationDataToDisk() ' Back into editing mode Me.Edit()End Sub Any ideas?
|
By StrataFrame Team - 6/12/2007
Yes, there is a cache of the values within the application. It is faster to cache the values in a dictionary than to retrieve them every time from the database. There is not an explicit ClearCache() method, but you can clear the cache by setting the MessageLocaleID just like you did in your code sample. I wouldn't call the GetActiveLanguage() again, just do this:Localization.MessageLocaleID = Localization.MessageLocaleID It will do this in the Setter of that property: Set(ByVal value As Integer) _MessageCodePage = value '-- Clear out the cache Try _MessageCache.Clear() _TextValueCache.Clear() Catch ex As Exception End Try '-- Set the button localized values Try SetActiveLanguageButtonText(value) Catch End Try End Set
|
By Peter Denton - 6/12/2007
Thanks BenWorked perfecty. The other problem with setting language, you had already sorted out for me (http://forum.strataframe.net/Topic7964-10-1.aspx) with some updated dlls, but I have since inadvertantly reverted to the old ones. Peter
|
By StrataFrame Team - 6/13/2007
Good to hear
|
|