jpjoyal / jsperanto Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
If jsperanto is used in two or more modules on the same page, translations are replacing each other.
I have made the lib node/underscore compatible. This is done with little easy but the applyReplacement function has to be change because of the callbacks param order in each. see bottom
this should not brake anything, besides for people that are using jquery and underscore they would have to switch to _ such as _.jsperanto.init
Add to the factory function
if (typeof _ !== 'undefined') {
// Underscore.
factory(_);
} else if (typeof exports === 'object') {
removed the call to check if function and did it inline
options = (options == Object(options))? options : callback;
applyReplacement
function applyReplacement(string,replacementHash){
if ($.ajax === undefined) {
$.each(replacementHash, function (value, key) {
string = string.split([o.interpolationPrefix, key, o.interpolationSuffix].join('')).join(value);
});
} else {
$.each(replacementHash, function (key, value) {
string = string.split([o.interpolationPrefix, key, o.interpolationSuffix].join('')).join(value);
});
}
return string;
}
It would be nice if I can install jsperanto with bower
Bonjour Jean-Philippe!
Great work on this lib.
I'm debating on a JS localisation library for nodeJs/backbone. JsPeranto would be my first pick for its simplicity, but I'd like to use dictionary on the server as well for email templating. Any experience on using the lib on the client + server?
PS: Your JSON format is fully supported on https://webtranslateit.com, it seem to be quick and simple translating tool, it may be worth mentioning it to other users (as it's solve the entire translation workflow for lazy devs like me).
Cheers!
félix
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.