visual-studio - 从 Visual Studio 运行应用程序时找不到 *.properties 文件

标签 visual-studio sapui5

在VS2013中开发OpenUI5项目时遇到国际化问题。找不到 i18n.properties:

"GET http://localhost:28091/i18n/i18n.properties 404 (Not Found) sap-ui-core.js:126 "

这是我的项目设置:

./i18n/i18n.properties

showHello=Hello

./internationization/Main.controller.js

onInit: function() {
  var oResourceModel = new sap.ui.model.resource.ResourceModel({
    bundleName : "i18n.i18n"
  });
  // ...
},

./internationization/Main.view.xml

<mvc:View controllerName="internationization.Main" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m">
  <Page title="Title">
    <Button text="{i18n>showHello}"/>
  </Page>
</mvc:View>

非常感谢您的提前帮助。

最佳答案

我在使用 Visual Studios 开发网络服务器时遇到了同样的问题。

您必须通过在项目根目录的 web.config 中提供 mime 映射来配置它以部署 .properties 文件:

<configuration>
  <system.webServer>
    <staticContent>
      <mimeMap fileExtension=".properties" mimeType="application/text"/>
    </staticContent>
  </system.webServer>
</configuration>

只需添加 <mimeMap/>元素及其父元素(如果缺失)。

关于visual-studio - 从 Visual Studio 运行应用程序时找不到 *.properties 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39844286/

相关文章:

c# - Windows 窗体设计器错误 "Illegal characters in path."

无法弄清楚为什么程序在 C 中崩溃

xml - 在XML中设置Fragment的 Controller

javascript - 如何在 UI5 中动态创建 OData V2 实体路径?

c# - .NET Core 应用程序调试错误 : "Unable to set the next statement. This file does not exactly match the original version."

将 GhostPDL 编译为 DLL

javascript - 在 WebIDE 中获取 SAPUI5 的用户名

javascript - Controller 中的表达式绑定(bind)

caching - 防止浏览器缓存 UI5 应用程序资源

visual-studio - .h 文件中的值未在 .rc 文件中定义