jquery mobile button style is lost on localization


Im working on jquerymobile project using localization library i18Next

html code

<div id="messageboxPage" data-role="page" data-theme="a">
    <div data-role="header" data-theme="a"></div>
    <div id="messagePage" data-role="content" data-theme="a">
        <div class="barContainer" id="barContainer">
            <div class="ui-bar ui-bar-b  ui-btn-corner-all" style=" margin-top: 40px; padding-left: 0px;padding-right:10px; ">
                <div style="float: left;  width: 30%;"> <a href="#" id="aNo" onclick="SetActive('aNo')" class="LnkButton" data-theme="a" data-role="button" data-inline="true" data-mini="true">Cancel</a> 
                <div style="float: left;   width: 30%;padding-left: 6%; padding-right: 2%;"> <a href="#" id="aAccept" onclick="Supprimer();" data-theme="a" class="LnkButton" data-role="button" data-inline="true" data-mini="true">Delete</a> 
                <div style="float: right; width: 30%;"> <a href="#" id="aReply" onclick="Reply();" data-theme="a" class="LnkButton" data-role="button" data-inline="true" data-mini="true">Reply</a> 

js code

 window.opts = {
     lng: 'fr',
     getAsync: true,
     // fallbackLng: 'en',
     ns: {
         namespaces: ['ns.controls'],
         defaultNs: 'ns.controls'
     useLocalStorage: false,
     debug: true
 $.i18n.init(opts).done(function () {
     alert('i18n init function');
     $('#aNo').text("No Merci!");

 $(document).ready(function () {
     alert('messagebox document ready');

Now problem is text is changed but button style is lost second problem setting text with labels i have tried page create trigger, but its not working what do you suggest. here is working jsfiddle

Problem courtesy of: skhurams


To change the text of a button you have to modify the text of the .ui-btn-text element, much better than the span > span thing:

$('#aNo .ui-btn-text').text("No Merci!");
$('#aAccept .ui-btn-text').text("Supprimer");
$('#aReply .ui-btn-text').text("Respondre");  


Solution courtesy of: ojovirtual


this worked for me

$.i18n.init(opts).done(function () {
     alert('i18n init function');
     var message_type = 0;
     if (message_type == "0") {
         alert('from 0');
         $('#lblTo').text("from 0");
     } else if (message_type == "1") {
         alert('to 1');
         $('#lblTo').text("to 1");
     } else if (message_type == "2") {
         alert('from 2');
         $('#lblTo').text("from 2");


     //////////////////////////this is where i was wrong
     $('#aNo > span > span').text("No Merci!");
     $('#aAccept > span > span').text("Supprimer");
     $('#aReply > span > span').text("Respondre");

Discussion courtesy of: skhurams

This recipe can be found in it's original form on Stack Over Flow.