Closed marcobuschini closed 4 years ago
I can, perhaps, get inspiration from http://www.java2s.com/Code/Java/I18N/AtextformatsimilartoMessageFormatbutusingstringratherthannumerickeys.htm
Maybe messageformat for Javascript can generate files that can be loaded with this method: https://medium.com/better-programming/angular-load-external-javascript-file-dynamically-3d14dde815cb
Best option: learn how to use messageformat from https://github.com/lephyrus/ngx-translate-messageformat-compiler/blob/master/src/lib/translate-message-format-compiler.ts
Is your feature request related to a problem? Please describe. At present translations are performed via debug templates. Those are not viable for production.
Describe the solution you'd like I would love to implement MessageFormat syntax as described at http://userguide.icu-project.org/formatparse/messages but without the full burden of MessageFormat API and data structures. Simply a function
format(string, parameters)
would be perfect.Describe alternatives you've considered JavaScript messageformat (https://messageformat.github.io/messageformat/) has been considered, but it compiles messages to JavaScript at build time. That is incompatible with my dynamic RXJS approach that loads translations only when needed.