首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从resx文件读取资源

从resx文件读取资源
EN

Stack Overflow用户
提问于 2018-03-06 10:38:21
回答 1查看 548关注 0票数 0

我为不同语言定义了资源文件- Resources.de-DE.resx - Resources.en-US.resx - Resources.es-ES.resx - Resources.fr-FR.resx - Resources.it-IT.resx - Resources.nl-NL.resx - Resources.resx

我正在尝试获取以下字符串的本地化值:“{user.Name}创建的通知”。

我尝试了很多方法来接受在正确的资源文件中指定的字符串,但是它不起作用:它总是接受Res中指定的“默认”字符串:

代码语言:javascript
复制
    var resourceName = $"MyFunctionApp.Properties.Resources.{plant.LanguageCode}.resx";
    var resourceSet = new ResourceSet(Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName));
    string createdBy = resourceSet.GetString(_notificationReportedBy);

甚至:

代码语言:javascript
复制
    Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(plant.LanguageCode);
    string longDescription = $"{Resources.NotificationReportedBy} {notificationReported.ValidatedBy }\n{notificationReported.LongDescription}";

也许Azure函数不能正确地支持资源文件?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-03-06 18:00:52

Azure函数目前不支持资源文件。这个GitHub问题跟踪此类支持的讨论和实现:https://github.com/Azure/Azure-Functions/issues/581

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49128794

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档