2017-01-25 14:01:00
Topic starter
Both '#key#' and Labels.get('key') retrieve Localized messages.
Is there a architectural preference between these approaches?
Labels.get('key') is client-side executed
Instances of '#key#'
within a JS file are resolved on the server-side for a language (en_US, for example) when the file is first requested from a client. Subsequent requests are fast because the internationalized version of the file is already generated. Note that this only happens for JS files under the web/public/jsmodules/
folder.
I would recommend using '#key#'
whenever possible because it will be faster to execute on the client. You should use Labels.get('key')
when:
key
at runtimemessage.key=Failed with error: {0}
)build.jsb
; in other words, it does not live under web/public/jsmodules/