2016-10-04 8 views
0

VS2013でOpenUi5プロジェクトを開発する際に、国際化に問題が発生しました。 i18n.propertiesを取得することができません。i18n.properties Not Found OpenUI5

:ここでは "http://localhost:28091/i18n/i18n.properties 404(見つかりません)SAP-UI-のCore.js GET 126"

は私のプロジェクトの設定です:

./国際化/ i18n.properties

showHello=Hello 

./internationization/Main.controller.js

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

    sap.ui.getCore().setModel(oResourceModel, "i18n"); 
}, 

./internationization/Main.view.xml

<core:View 
     xmlns:core="sap.ui.core" 
     xmlns:mvc="sap.ui.core.mvc" 
     xmlns="sap.m" 
     controllerName="internationization.Main" 
     xmlns:html="http://www.w3.org/1999/xhtml"> 

     <Page title="Title"> 
      <content> 
       <Button text="{i18n>showHello}"/> 
      </content> 
     </Page> 
</core:View> 

事前にあなたの助けのためにありがとうございました。

答えて

0

私は、Visualスタジオの開発ウェブサーバを使用して同じ問題を抱えていました。

あなたは、プロジェクトのルートにweb.configファイル内のMIMEマップを提供することにより、.propertiesファイルを展開するように設定する必要があります。

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

不足している場合だけ<mimeMap/>要素とその両親を追加します。

+0

これは働いています!!!!!!あなたの助けをありがとう、私に多くの時間を節約してくれてありがとう!! @schnoedel – angwong

0

ResorceModelをインスタンス化している間に絶対パスを指定する必要があります。 MYPROJECTがプロジェクトの名前ですので、もしパスです

は、プロジェクト名から始まりますし、コードは次のようになります。

var oResourceModel = new sap.ui.model.resource.ResourceModel({ 
    bundleName : "myProject.i18n.i18n" 
}); 
+0

@Dopwdevご回答いただきありがとうございます。それは期待どおりに動作していないようです。 – angwong