i have my main page (index.php) with look as :
<?php start_session();
... PHP CODE ...
?>
<html>
... HTML CODE ...
<script type="text/javascript">
var bscTexts =
{
signup: {
cropPicture: 'Crop your profile picture',
},
home: {
noFavorites: 'You haven´t added any profiles as favorites'
},
general: {
errorUploading: 'Error uploading, please try again',
successfulUploading: 'Votre photo a bien été obtenue',
chooseAnotherPicture: 'Choisir une autre photo',
loadingMore: 'Loading, please wait...'
},
notificationBubbles: {
/*InterestedInYou */ 1: {
Text: '[Name] has shown interest in you',
Url: "/match/interestedinme"
},
/*Match */ 2: {
Text: 'You and [Name] are now a match',
Url: "/match/matches"
},
/*WinkSent */ 3: {
Text: 'You have received a wink from [Name]',
Url: "/home/socialstream"
},
/*LovedPicture */ 4: {
Text: '[Name] loves one of your pictures',
Url: "/home/socialstream"
}
}
};
</script>
... OTHER HTML CODE ...
</html>
I would like to know if is possible to replace the text (string statement) with jquery or other (dom)
for example :
if i call alert(bscTexts.signup.cropPicture); the result is popup alert with "Crop your profile picture"
i need to know if is possible after the page is loaded with jquery, javascript or other to replace "Crop your profile picture" with french translation to obtain this :
<script type="text/javascript">
var bscTexts =
{
signup: {
cropPicture: 'Redimensionnez votre photo',
}
</script>
This is for example so i need to change ALL strings.
Thank you for your helping !
There is a function for in jquery for rewrite vars after document ready :
jQuery(function($){
... rewrite your vars...
})
If you will change all strings just assign the object again :
bscTexts = { ... };
if you have just the strings replace each one:
bscTexts.signup.cropPicture = 'new value';
.
.
bscTexts.notificationBubbles.Text = 'new value';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.