从卫星程序集中获取所有受支持的文化
我正在使用卫星程序集来保存 C# 应用程序中的所有本地化资源。
我需要做的是在 GUI 中创建一个菜单,其中包含应用程序现有的所有可用语言。 有什么办法可以动态获取信息吗?
I am using a satellite assembly to hold all the localization resources in a C# application.
What I need to do is create a menu in the GUI with all the available languages that exists for the application. Is there any way to get information dynamically?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
此函数返回 App_GlobalResources 文件夹中所有已安装区域性的数组 - 根据您的需要更改搜索路径。
对于不变的文化,它返回“auto”。
您还可以使用此功能来获取完整的 CultureInfo 实例的更多功能:
This function returns an array of all the installed cultures in the App_GlobalResources folder - change search path according to your needs.
For the invariant culture it returns "auto".
You could also use this one for more functionality getting the full CultureInfo instances:
特定语言的每个附属程序集都具有相同的名称,但位于以特定文化命名的子文件夹中,例如 fr 或 fr-CA。
也许您可以利用这一事实并扫描文件夹层次结构来动态构建该菜单。
Each satellite assembly for a specific language is named the same but lies in a sub-folder named after the specific culture e.g. fr or fr-CA.
Maybe you can use this fact and scan the folder hierarchy to build up that menu dynamically.