ember.jsinternationalizationember-i18n

Javascript (Ember) I18N for a block, not just a string


We're using ember-i18n to do i18n in our Ember app, and so far it's been fine. We've got a bunch of keys for strings like "Cancel" and "Save" and "Please don't do that", but I'm not sure if string-based i18n is the right way to approach the section I hit today, which is basically a warning (I'm inventing this text, but the sentiment is the same):

Stop! What you're about to do cannot be undone. If you click the next button, you accept responsibility for:

  • Three small children
  • The Greek sovereign debt crisis
  • Windows 98

If you agree, click "I Agree" to continue.

Should I just put a bunch of keys in the language file for that block? One key for the whole shebang, HTML and all? Or is there another way?


Solution

  • Hi @pjmorse i would suggest you to use a bunch of keys for two reasons.

    1. Here both html tag and text are need to be combined as a value for the key you needed.

    eg:

    Stop! What you're about to do cannot be undone. If you click the next button, you accept responsibility for: <br>
    <ul>
    <li>
    Three small children<li>
    <li>The Greek sovereign debt crisis<li>
    <li>Windows 98<li>
    </ul>
    

    which would be bad practice to my knowledge. Also,

    2 . what if you want to change the <ul> to <ol>

    you need to change in all your language files. so better use bunch of keys and seperate the html design from internationalization.

    happy coding.