Posts Tagged ‘locale’

Ruby on Rails Paperclip com I18n

Postado em 18 nov 2009
Categoria(s) I18n, Ruby on Rails

O plugin paperclip não tem suporte para i18n por padrão.

Então vamos implementar isso no braço, talvez não seja a forma mais elegante do mundo, mas funciona.

No seu model:

class Ong < ActiveRecord::Base
  # Paperclip
  has_attached_file :logo, :styles => { :thumb => "100x100>" }
  validates_attachment_size :logo, :less_than => 50.kilobytes, :message => I18n.t('activerecord.errors.messages.attachment_size', :min => 0, :max => 50.kilobytes)
end

Agora você precisar criar a diretiva activerecord.errors.messages.attachment_size no seu config/locales/pt-BR.yml:

pt-BR:
  # Active Record
  activerecord:
    errors:
      template:
        header:
          one: "Não foi possível gravar: 1 erro"
          other: "Não foi possível gravar: {{count}} erros."
        body: "Por favor, verifique o(s) seguinte(s) campo(s):"
      messages:
        attachment_size: "tamanho do arquivo deve estar entre {{min}} e {{max}} bytes"

Pronto! Seja feliz!
Se o plugin não faz, a gente faz.

Se você gostou desse texto e acha que ajudou você, me recomende: Recommend Me.

  • Share/Bookmark

Ubuntu resolvendo problema de locale: perl: warning: Please check that your locale settings

Postado em 25 set 2009
Categoria(s) Ubuntu

Para resolver o problema:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "pt_BR.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

Siga os passos abaixo:

No terminal digite:

sudo apt-get install --reinstall language-pack-en
sudo apt-get install --reinstall language-pack-pt
sudo locale-gen
sudo dpkg-reconfigure locales

Pra mim resolveu! :)

  • Share/Bookmark