2017-12-10 16 views
0

私は、国際化に関連するすべてのファイルを変更した:JHipster 4.x.xで国際化を実装する方法は?

  • src/main/resources/i18n/messages_en.properties
  • src/main/webapp/i18n/en/produto.json(私の新しいエンティティ)すでにのjhiTranslate

なしがありませんでしたspanタグへ

  • 追加translate属性これらの変更により翻訳が適用されました。私はすでにアプリケーションを再実行し、8080ポートでプロセスを終了し、さらにコンピュータを再起動しました。

    produto.component.html

    messages_en.properties

    <th jhiSortBy="nome"><span jhiTranslate="myApp.produto.nome" translate="myApp.produto.nome">Nome</span> <span class="fa fa-sort"></span></th>

    :のようなこれらのファイルで行った変更は、なかったかのようにtargetフォルダ内に生成されたファイルはすべて、ネイティブ言語を使用している

    ### ENTITIES 
    ## PRODUCT 
    myApp.produto.nome=Name 
    myApp.produto.descricao=Description 
    myApp.produto.preco=Price 
    myApp.produto.dataVencimento=Due Date 
    

    produto.json

    { 
    "myApp": { 
         "produto" : { 
          "home": { 
           "title": "Products", 
           "createLabel": "Create a new Product", 
           "createOrEditLabel": "Create or edit a Product" 
          }, 
          "created": "A new Product is created with identifier {{ param }}", 
          "updated": "A Product is updated with identifier {{ param }}", 
          "deleted": "A Product is deleted with identifier {{ param }}", 
          "delete": { 
           "question": "Are you sure you want to delete Product {{ id }}?" 
          }, 
          "detail": { 
           "title": "Product" 
          }, 
          "nome": "Name", 
          "descricao": "Description", 
          "preco": "Price", 
          "dataVencimento": "Due Date" 
         } 
        } 
    } 
    

    jHipsterによって生成されたデフォルトのテキストのみが翻訳されます。

    解決方法はありますか?

  • 答えて

    2

    右のファイルです:src/main/webapp/i18n/en/produto.json

    使用して、あなたのアプリケーションを起動した場合、./mvnw(バックエンド)yarn start(フロントエンド)もしあれば、その後、変更が、そうでない場合localhost:9000

    時に自動的に適用されますバックエンドを開始しただけで、フロントをコンパイルする必要があります。yarn webpack:buildを使用して、ブラウザをリフレッシュしてください。localhost:8080

    関連する問題