简体   繁体   中英

How to use strongly-typed satellite assembly?

In my particular scenario, different users have different requirements of what the text of messages, labels, etc are, even though there's no language change. ie: the language always remains en-US.

Currently, I have all my string resources in an internal resources file and I use strongly-typed in my code.

To move the string resources to a satellite assembly I'm following the following MSDN article . So far I've managed to create a .resources file and the corresponding satellite assembly. In this article, the example to get a string resources uses GetString() instead of strongly-typed.

So how do I tell the app do use a different satellite assembly without losing the ability to use strongly-typed access?

It may not be the ideal solution, but our approach to this problem was simply to have the resource keys as public static strings, and this list is the canonical source for key value names.

So while they are just string values, it's easy to verify in code review that names aren't being simply free-formed in, and an acceptance test can verify that all of the keys which should be present in the source file do exist.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM