angular2latinize

1.0.0 • Public • Published

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'});

Package Sidebar

Install

npm i angular2latinize

Weekly Downloads

11

Version

1.0.0

License

MIT

Last publish

Collaborators

  • luckylooke