Created
October 14, 2016 20:41
-
-
Save carvalhoviniciusluiz/b59a3d86c7bcaff7a9aa2b18661a24c7 to your computer and use it in GitHub Desktop.
alter rules of the Ember.Inflector for pt-BR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Inflector from 'ember-inflector'; | |
Ember.Inflector.inflector.rules = { | |
plurals: [ | |
[/$/, 's'], | |
[/(s)$/i, 's'], | |
[/^(paí)s$/i, 'ses'], | |
[/(z|r)$/i, 'es'], | |
[/al$/i, 'ais'], | |
[/el$/i, 'eis'], | |
[/ol$/i, 'ois'], | |
[/ul$/i, 'uis'], | |
[/([^aeou])il$/i, 'is'], | |
[/m$/i, 'ns'], | |
[/(ês|es)$/i, 'eses'], | |
[/(ás|as)$/i, 'ases'], | |
[/ao$/i, 'oes'], | |
[/ão$/i, 'ões'], | |
[/^(irm|m)ao$/i, 'aos'], | |
[/^(irm|m)ão$/i, 'ãos'], | |
[/^(alem|c|p)ao$/i, 'aes'], | |
[/^(alem|c|p)ão$/i, 'ães'], | |
], | |
singular: [ | |
[/([^ê])s$/i, ''], | |
[/^(á|gá|paí)s$/i, 's'], | |
[/(r|z)es$/i, ''], | |
[/([^p])ais$/i, 'al'], | |
[/eis$/i, 'el'], | |
[/ois$/i, 'ol'], | |
[/uis$/i, 'ul'], | |
[/(r|t|f|v)is$/i, 'il'], | |
[/ns$/i, 'm'], | |
[/sses$/i, 'sse'], | |
[/^(.*[^s]s)es$/i, ''], | |
[/ães$/i, 'ão'], | |
[/aes$/i, 'ao'], | |
[/ãos$/i, 'ão'], | |
[/aos$/i, 'ao'], | |
[/ões$/i, 'ão'], | |
[/oes$/i, 'ao'], | |
[/(japon|escoc|ingl|dinamarqu|fregu|portugu)eses$/i, 'ês'], | |
[/^(g|)ases$/i, 'ás'], | |
], | |
irregularPairs: [ | |
['pais', 'paises'], | |
], | |
uncountable: [ | |
'tórax', | |
'tênis', | |
'ônibus', | |
'lápis', | |
'fênix', | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment