When developing an AJAX program, I came across a design solution for creating an I18N string in JavaScript.code. Some string is used only by JavaScript. For example.
$('#submit').click(function() {
$(
}
I would like the I18N line "Wait while you send ...". I am not sure if this is the best way to do this. Currently, I have an I18N-ed line on the server and is displayed in the javascript variable on the page (I am using PHP / wordpress).
<script>strSubmit = <?php _e('Please wait while submitting...'); ?></script>
Then in javascript I just use varialble
$('#submit').click(function() {
$(
}
It works, but it looks messy. Is there a better way to achieve this?
source
share