Multiple Localization files


Author
Message
StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
When you have several DLLs that each have their own collection of messages, it's best to use embedded XML files.  Basically, you add the XML files directly to your project.  We generally create a folder within the project called Localized Messages and put the XML files in there.  Then, on the properties for those files, you set the Build Action to Embedded Resource.  At runtime, those XML files will be extracted from the DLL and registered within the message cache. 

Otherwise, you'll either need to combine all of your messaging projects, or use SQL because the message files need specific names and you can't have them all in the same folder at runtime when they all have the same names.  As to the RegisterEmbeddedXmlFile() method, the StrataFrameApplication class should pick up on all of the embedded files on its own, but in the chance that you're not using StrataFrameApplication or it just misses the file, you can use the RegisterEmbeddedXmlFile() method to get the messages in that file into the runtime cache.

Tim Dol
Tim Dol
StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)
Group: Forum Members
Posts: 340, Visits: 1.4K
Ben,

I want to make sure I understand this and make changes in the correct place.

I have one executable called AvMenu.exe.  This project has a folder containing the localization files. In the appMain i have set the following.

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

I have a CRM.DLL project, which also has a folder containing it's localization files and I have a Scheduling.DLL project which has a folder containing it's localization files... and so on.

Do I add the line Localization.RegisterEmbeddedXmlFile()... for each project's localization file in the AvMenu appMain or within the DLL itself?


StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
When using localization, we have a dictionary that caches off the localized values.  This dictionary stores all of the values by their localization key, so every key has to be unique.  If you're using the same key across multiple module localization files, the first one that gets loaded into the cache is going to be the one that will be used... so, to use the localization values for other modules, you'll need to have unique keys between the modules.  Also, if the localization file does not get automatically registered (and you're getting key not found exceptions when you've embedded the file), you can manually register the file in the InitApplication() method using the Localization.RegisterEmbeddedXmlFile() method.
Tim Dol
Tim Dol
StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)StrataFrame User (408 reputation)
Group: Forum Members
Posts: 340, Visits: 1.4K
I wrote a front-end menu system for our legacy application. I created a messaging project for this and included the messaging files as an embedded resource which worked fine.

We are now beginning to write new modules so I created a new localization project for each module, so we can logically separate the module-specific messages and text values, and I checked off to include the common repository when generating the XML files. I added a folder to the DLL project to place the localization files and selected embedded resource as the build action.

Now I think I have a problem. When I try to retrieve the module-specific text values it appears to be access the main localization file in my menu system project, which I guess makes sense, since this was probably set in the appMain?

Is this an acceptable approach, and if so, what do I need to do to access my module-specific messages and text values? 

Thanks

Tim

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search