commit/galaxy-central: carlfeberhard: JS Localization: fix replicate quotameter code in galaxy.masthead.mako; add mako localization function file
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/087a792e45bc/ Changeset: 087a792e45bc User: carlfeberhard Date: 2013-09-05 19:49:46 Summary: JS Localization: fix replicate quotameter code in galaxy.masthead.mako; add mako localization function file Affected #: 2 files diff -r 4e86427c63f63b1d9a3278ea0adfbe0e89906c83 -r 087a792e45bcfb48d0717f6947520b44d9b56d11 templates/webapps/galaxy/galaxy.masthead.mako --- a/templates/webapps/galaxy/galaxy.masthead.mako +++ b/templates/webapps/galaxy/galaxy.masthead.mako @@ -230,7 +230,7 @@ <!-- quota meter --> ${h.templates( "helpers-common-templates", "template-user-quotaMeter-quota", "template-user-quotaMeter-usage" )} - ${h.js( "mvc/base-mvc", "mvc/user/user-model", "mvc/user/user-quotameter" )} + ${h.js( "mvc/base-mvc", "utils/localization", "mvc/user/user-model", "mvc/user/user-quotameter" )} <script type="text/javascript"> // start a Galaxy namespace for objects created diff -r 4e86427c63f63b1d9a3278ea0adfbe0e89906c83 -r 087a792e45bcfb48d0717f6947520b44d9b56d11 templates/webapps/galaxy/utils/localization.mako --- /dev/null +++ b/templates/webapps/galaxy/utils/localization.mako @@ -0,0 +1,12 @@ +<%def name="localize_js_strings( strings_to_localize )"> +##PRECONDITION: static/scripts/utils/localization.js should be loaded first +## adds localized versions of strings to the JS GalaxyLocalization for use in later JS +## where strings_to_localize is a list of strings to localize +<script type="text/javascript"> + ## strings need to be mako rendered in order to use the '_' gettext helper for localization + ## these are then cached in the js object + GalaxyLocalization.setLocalizedString( + ${ h.to_json_string( dict([ ( string, _(string) ) for string in strings_to_localize ]) ) } + ); +</script> +</%def> Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org