angular2latinize
v1.0.0
Published
Angular 2 simple latinize service for removing accents from latin characters, also for ionic 2 applications
Downloads
11
Maintainers
Readme
angular2latinize
Angular 2 simple latinize service for removing accents from latin characters, also for ionic 2 applications.
installation
npm install angular2latinize
usage
my-class.ts
import { Latinize } from 'angular2latinize';
export class myClass {
constructor (
public latinize: Latinize
) {
console.log('latinize "crème brûlée" -> ', this.latinize.convert('crème brûlée')); // results 'creme brulee'
}
}
app-module.ts
import { NgModule } from '@angular/core';
import { Latinize } from 'angular2latinize';
@NgModule({
// ...
providers: [
Latinize
]
})
export class AppModule {}
Extending characters map
You can use the Latinize.charmap object to access the translation dictionary or to change the mapping
Latinize.charmap['Ω'] = 'O';
// modify the behavior for German umlauts
_.extend(Latinize.charmap,
{'Ä': 'Ae', 'Ä': 'Ae', 'Ü': 'Ue', 'ä': 'ae', 'ö': 'oe', 'ü': 'ue'});