Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.
/ latinize Public archive
forked from dundalek/latinize

Simple library to convert accents (diacritics) from strings to latin characters.

Notifications You must be signed in to change notification settings

418sec/latinize

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Latinize.js

Simple library to convert accents (diacritics) from strings to latin characters.

Install

npm install latinize

or

bower install latinize

Usage

node.js

var latinize = require('latinize');
latinize('ỆᶍǍᶆṔƚÉ áéíóúýčďěňřšťžů'); // => 'ExAmPlE aeiouycdenrstzu'

AMD

require(['latinize'], function(latinize){
  latinize('ỆᶍǍᶆṔƚÉ áéíóúýčďěňřšťžů');
});

browser

<script src="../latinize.js"></script>
<script>
    document.write(latinize('ỆᶍǍᶆṔƚÉ áéíóúýčďěňřšťžů'));
</script>

You can use the latinize.characters object to access the translation table or to change the mapping:

latinize.characters['Ω'] = 'O';

// modify the behavior for German umlauts
_.extend(latinize.characters,
  {'Ä': 'Ae', 'Ä': 'Ae', 'Ü': 'Ue', 'ä': 'ae', 'ö': 'oe', 'ü': 'ue'});

Details

Is is a lookup table taken from http://jsperf.com/latinize packaged for node and browser. Visit the link to see more approaches.

About

Simple library to convert accents (diacritics) from strings to latin characters.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%