diff options
-rw-r--r-- | Gemfile | 3 | ||||
-rw-r--r-- | app/controllers/application_controller.rb | 25 | ||||
-rw-r--r-- | app/controllers/posts_controller.rb | 1 | ||||
-rw-r--r-- | app/controllers/publics_controller.rb | 1 | ||||
-rw-r--r-- | config/locales/inflections/all.yml | 44 | ||||
-rw-r--r-- | config/locales/inflections/pl.yml | 64 |
6 files changed, 138 insertions, 0 deletions
@@ -25,6 +25,9 @@ gem 'bson', '1.1' gem 'haml' gem 'will_paginate', '3.0.pre2' +#Inflected translations +gem 'i18n-inflector-rails', '0.1.0' + #Uncatagorized gem 'roxml', :git => 'git://github.com/Empact/roxml.git' gem 'addressable', :require => 'addressable/uri' diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 3f077160a..198035cd9 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -11,6 +11,9 @@ class ApplicationController < ActionController::Base before_filter :count_requests before_filter :set_invites before_filter :set_locale + before_filter :set_grammatical_gender + + inflection_method :grammatical_gender => :gender def set_contacts_notifications_and_status if user_signed_in? @@ -50,6 +53,28 @@ class ApplicationController < ActionController::Base end end + def set_grammatical_gender + if (user_signed_in? && I18n.inflector.inflected_locale?) + gender = current_user.profile.gender.to_s.tr('!()[]"\'`*=|/\#.,-:', '').downcase + unless gender.empty? + i_langs = I18n.inflector.inflected_locales(:gender) + i_langs.delete I18n.locale + i_langs.unshift I18n.locale + i_langs.each do |lang| + token = I18n.inflector.true_token(gender, :gender, lang) + unless token.nil? + @grammatical_gender = token + break + end + end + end + end + end + + def grammatical_gender + @grammatical_gender || nil + end + def similar_people contact, opts={} opts[:limit] ||= 5 aspect_ids = contact.aspect_ids diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 432bdecbc..a8e8cd6a2 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -7,6 +7,7 @@ class PostsController < ApplicationController skip_before_filter :count_requests skip_before_filter :set_invites skip_before_filter :set_locale + skip_before_filter :set_grammatical_gender def show @post = Post.first(:id => params[:id], :public => true) diff --git a/app/controllers/publics_controller.rb b/app/controllers/publics_controller.rb index 3021cdccd..b91af7df0 100644 --- a/app/controllers/publics_controller.rb +++ b/app/controllers/publics_controller.rb @@ -10,6 +10,7 @@ class PublicsController < ApplicationController skip_before_filter :count_requests skip_before_filter :set_invites skip_before_filter :set_locale + skip_before_filter :set_grammatical_gender layout false caches_page :host_meta diff --git a/config/locales/inflections/all.yml b/config/locales/inflections/all.yml new file mode 100644 index 000000000..476a2af10 --- /dev/null +++ b/config/locales/inflections/all.yml @@ -0,0 +1,44 @@ + +all: + i18n: + inflections: + gender: + f: "female" + m: "male" + n: "neuter" + masculine: @m + male: @m + man: @m + boy: @m + b: @m + he: @m + sir: @m + mr: @m + mister: @m + guy: @m + dude: @m + gentleman: @m + mal: @m + female: @f + feminine: @f + girl: @f + g: @f + lady: @f + she: @f + miss: @f + missus: @f + mrs: @f + missis: @f + mistress: @f + ms: @f + neuter: @n + neutral: @n + it: @n + they: @n + impersonal: @n + default: n + + + + + diff --git a/config/locales/inflections/pl.yml b/config/locales/inflections/pl.yml new file mode 100644 index 000000000..7d02bea80 --- /dev/null +++ b/config/locales/inflections/pl.yml @@ -0,0 +1,64 @@ + +pl: + i18n: + inflections: + gender: + f: "rodzaj żeński" + m: "rodzaj męski" + n: "rodzaj nijaki" + masculine: @m + facet: @m + chłop: @m + chłopak: @m + chłopek: @m + chłopiec: @m + chłopaczek: @m + mąż: @m + prawiczek: @m + prawik: @m + boj: @m + woj: @m + gość: @m + gostek: @m + gościu: @m + samiec: @m + samczyk: @m + kawaler: @m + mężczyzna: @m + męski: @m + pani: @f + kobieta: @f + k: @f + kobietka: @f + dziewczyna: @f + dziewczę: @f + baba: @f + babka: @f + facetka: @f + dziewczynka: @f + dziewica: @f + niewiasta: @f + samica: @f + samiczka: @f + ona: @f + panna: @f + pannica: @f + panienka: @f + żeński: @f + laska: @f + lasencja: @f + żona: @f + dziewoja: @f + neuter: @n + to: @n + ono: @n + dziecko: @n + ktoś: @n + coś: @n + impersonal: @n + nijaki: @n + default: n + + + + |