summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/models/translation.js.coffee
blob: 45c276a8ca89f3daf4d6df13d5ab0d039c6b3178 (plain)
1
2
3
4
5
6
7
8
class csx.Translation
  constructor: (modelKey) ->
    @modelKey = modelKey

  errorFor: (attribute, scope) ->
    attributeName = I18n.t("activerecord.attributes.#{@modelKey}.#{attribute}")
    error = I18n.t("errors.messages.#{scope}")
    "#{attributeName} #{error}"