While developing AJAX program, I met the design decision to make string I18N in JavaScript.code. Some string is only used by JavaScript. For example.
$('#submit').click(function() {
$(#target).html('Please wait while submitting...').load(someURI);
}
I'd like to I18N the string 'Please wait while submitting...'. I'm not sure what's the best way to do it. Currently, I just have the string I18N-ed in server and rendered into a javascript variable in page (I'm using PHP/wordpress).
<script>strSubmit = <?php _e('Please wait while submitting...'); ?></script>
Then, in javascript, I just use the varialble
$('#submit').click(function() {
$(#target).html(strSubmit).load(someURI);
}
This works, but it looks messy. Is there any better way to achieve this?