文化资源档案

发布于 2024-08-22 12:54:22 字数 136 浏览 2 评论 0原文

我正在开发一个 ASP.NET 应用程序,

我有几个资源文件,其中包含我可以支持的不同语言 示例:Language.en.resx Language.pt.resx

有没有办法动态获取包含所有不同语言的列表?

I'm working on an ASP.NET app

I have a couple of resource files with the different languages I can support
example: Language.en.resx
Language.pt.resx

Is there any way to get, for example, a list with all the different languages dynamically?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眼泪也成诗 2024-08-29 12:54:22

如果您正在寻找一种方法来确定为应用程序本地化多少种(以及哪些)语言。没有解决办法。
您必须编写一个解析器来查找应用程序(或给定)路径中的一系列子目录。读取 Resx 文件的名称并将其存储到列表中。

最后,您必须用点(split('.'))分割Resx文件的名称,并分隔Resx文件的语言部分,请

  string[] myString = new string[MyResxList.lenght];
  for (int i=0; i<=MyResxList.lenght;i++)
     myString[i] = MyResxList[i].toString().split('.')[3];

注意,上面的代码是一个片段,我在这里编写它,所以如果有必要,您必须进行调试

那么你应该删除重复项并返回列表

If you are looking for a way which determine how many ( and what ) languages you localize for your application. There is no solution.
You have to write a parser which look in a series of sub directories in your application ( or given ) path. the read and store the name of Resx files into a list.

Finally you have to split the name of Resx file with Dot (split('.')) and seperate the language part of the Resx files like

  string[] myString = new string[MyResxList.lenght];
  for (int i=0; i<=MyResxList.lenght;i++)
     myString[i] = MyResxList[i].toString().split('.')[3];

note that above code is a snippet and I wrote it here so you have to debugit if it's necessary

then you should remove the duplicates and return the List

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文