diff --git a/Gemfile b/Gemfile index dd743f74..2ada0849 100644 --- a/Gemfile +++ b/Gemfile @@ -58,6 +58,7 @@ gem 'rails-i18n' gem 'i18n-active_record', git: 'git://github.com/svenfuchs/i18n-active_record.git', require: 'i18n/active_record' +gem 'http_accept_language' # A superb font to use as icons gem 'font-awesome-rails' diff --git a/Gemfile.lock b/Gemfile.lock index a3f1ae76..bea3bea3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: git://github.com/gregbell/active_admin.git - revision: 04efdcc5ca0ed6c10ed921713c781a26f7740ba0 + revision: 4ea4042e0b14aedce3d6ed4ab5f4c3a84a954f18 specs: activeadmin (1.0.0.pre) arbre (~> 1.0, >= 1.0.2) @@ -155,6 +155,7 @@ GEM highline (1.6.21) hike (1.2.3) hitimes (1.2.2) + http_accept_language (2.0.2) http_parser.rb (0.6.0) i18n (0.6.11) inherited_resources (1.4.1) @@ -343,6 +344,7 @@ DEPENDENCIES guard-minitest guard-rubocop haml-rails + http_accept_language i18n-active_record! jbuilder (~> 2.0) jquery-rails diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 3246696b..cc5d1edd 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,6 +1,14 @@ # The top level controller, where can be centralised almost everything class ApplicationController < ActionController::Base + before_action :set_locale # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception + + private + + def set_locale + I18n.locale = http_accept_language + .compatible_language_from I18n.available_locales + end end diff --git a/app/mailers/event_mailer.rb b/app/mailers/event_mailer.rb index a5b1f555..9fff27e8 100644 --- a/app/mailers/event_mailer.rb +++ b/app/mailers/event_mailer.rb @@ -8,8 +8,8 @@ class EventMailer < ActionMailer::Base mail 'Message-ID' => "", to: event.submitter, - subject: t('mail_suffix') + - t('event_mailer.create.subject', subject: event.title) + subject: "#{t 'mail_prefix'}#{t 'event_mailer.create.subject', + subject: event.title}" end def accept(event, current_user) @@ -19,8 +19,8 @@ class EventMailer < ActionMailer::Base mail 'In-Reply-To' => "", to: event.submitter, - subject: t('mail_suffix') + - t('event_mailer.accept.subject', subject: event.title) + subject: "#{t 'mail_prefix'}#{t 'event_mailer.accept.subject', + subject: event.title}" end def destroy(event, current_user, reason) @@ -31,7 +31,7 @@ class EventMailer < ActionMailer::Base mail 'In-Reply-To' => "", to: event.submitter, - subject: t('mail_suffix') + - t('event_mailer.destroy.subject', subject: event.title) + subject: "#{t 'mail_prefix'}#{t 'event_mailer.destroy.subject', + subject: event.title}" end end diff --git a/app/mailers/moderation_mailer.rb b/app/mailers/moderation_mailer.rb index 72b80230..39d4e61a 100644 --- a/app/mailers/moderation_mailer.rb +++ b/app/mailers/moderation_mailer.rb @@ -7,8 +7,8 @@ class ModerationMailer < ActionMailer::Base mail 'Message-ID' => "", - subject: t('mail_suffix') + - t('moderation_mailer.create.subject', subject: event.title) + subject: "#{t 'mail_prefix'}#{t 'moderation_mailer.create.subject', + subject: event.title}" end def update(older_event, event, current_user) @@ -18,8 +18,8 @@ class ModerationMailer < ActionMailer::Base mail 'In-Reply-To' => "", - subject: t('mail_suffix') + - t('moderation_mailer.update.subject', subject: event.title) + subject: "#{t 'mail_prefix'}#{t 'moderation_mailer.update.subject', + subject: event.title}" end def accept(event, current_user) @@ -28,8 +28,8 @@ class ModerationMailer < ActionMailer::Base mail 'In-Reply-To' => "", - subject: t('mail_suffix') + - t('moderation_mailer.accept.subject', subject: event.title) + subject: "#{t 'mail_prefix'}#{t 'moderation_mailer.accept.subject', + subject: event.title}" end def destroy(event, current_user, reason) @@ -39,7 +39,7 @@ class ModerationMailer < ActionMailer::Base mail 'In-Reply-To' => "", - subject: t('mail_suffix') + - t('moderation_mailer.destroy.subject', subject: event.title) + subject: "#{t 'mail_prefix'}#{t 'moderation_mailer.destroy.subject', + subject: event.title}" end end diff --git a/app/mailers/note_mailer.rb b/app/mailers/note_mailer.rb index 1613f792..4a32e8e3 100644 --- a/app/mailers/note_mailer.rb +++ b/app/mailers/note_mailer.rb @@ -9,8 +9,8 @@ class NoteMailer < ActionMailer::Base "", to: note.event.submitter, - subject: t('mail_suffix') + - t('note_mailer.notify.subject', subject: note.event.title) + subject: "#{t 'mail_prefix'}#{t 'note_mailer.notify.subject', + subject: note.event.title}" end def create(note) @@ -18,7 +18,7 @@ class NoteMailer < ActionMailer::Base mail 'In-Reply-To' => "", - subject: t('mail_suffix') + - t('note_mailer.create.subject', subject: note.event.title) + subject: "#{t 'mail_prefix'}#{t 'note_mailer.create.subject', + subject: note.event.title}" end end diff --git a/app/views/events/show.html.haml b/app/views/events/show.html.haml index b620467a..cd713067 100644 --- a/app/views/events/show.html.haml +++ b/app/views/events/show.html.haml @@ -65,4 +65,4 @@ %p.tags %span.label= Event.human_attribute_name :tags - @event.tags.split.each do |tag| - = link_to tag, events_url(tag: tag) + = link_to tag, tag_url(tag) diff --git a/config/initializers/locale.rb b/config/initializers/locale.rb index 0bee853d..31a0dbbc 100644 --- a/config/initializers/locale.rb +++ b/config/initializers/locale.rb @@ -4,6 +4,7 @@ require 'i18n/backend/active_record' Translation = I18n::Backend::ActiveRecord::Translation if Translation.table_exists? - I18n.backend = I18n::Backend::Chain.new(I18n.backend, I18n::Backend::ActiveRecord.new) + I18n.backend = I18n::Backend::Chain.new(I18n::Backend::ActiveRecord.new, + I18n.backend) I18n::Backend::ActiveRecord.send :include, I18n::Backend::Memoize end diff --git a/config/locales/en.yml b/config/locales/en.yml index 287dc75d..ea1bb787 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,52 +1,9 @@ -# Files in the config/locales directory are used for internationalization -# and are automatically loaded by Rails. If you want to use locales other -# than English, add the necessary files in this directory. -# -# To use the locales, use `I18n.t`: -# -# I18n.t 'hello' -# -# In views, this is aliased to just `t`: -# -# <%= t('hello') %> -# -# To use a different locale, set it with `I18n.locale`: -# -# I18n.locale = :es -# -# This would use the information in config/locales/es.yml. -# -# To learn more, please read the Rails Internationalization guide -# available at http://guides.rubyonrails.org/i18n.html. - en: - show: Show - edit: Edit - destroy: Destroy - - attributes: - created_at: Created at - updated_at: Updated at - created: Created %{date} ago - updated: Updated %{date} ago - - activerecord: - models: - admin_user: Admin - comment: Comment - user: Contributor - city: City - region: Region - attributes: - user: - login: Id - email: Email - password: Password - lastname: Name - firstname: First name date: formats: month: "%B %Y" + period: From %{start} to %{end}. + same_day: On %{date} from %{start} to %{end}. time: formats: at: "%A %d %B %Y at %Hh%M" diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 9911fd56..0cbed25b 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -1,7 +1,6 @@ fr: date: formats: - long: "%A %d %B %Y" month: "%B %Y" period: Du %{start} au %{end}. same_day: Le %{date} de %{start} à %{end}. diff --git a/config/locales/models/en.yml b/config/locales/models/en.yml new file mode 100644 index 00000000..cf3fd196 --- /dev/null +++ b/config/locales/models/en.yml @@ -0,0 +1,63 @@ +en: + attributes: + id: ID + name: Name + email: Email + locality_0: Local + locality_1: National + created_at: Created + updated_at: Modified + created: Created %{date} ago + updated: Updated %{date} ago + + # Base de données + activerecord: + models: + event: Event + user: Modérator + lug: Asso + city: City + region: Region + admin_user: Admin + comment: Comment + i18n/backend/active_record/translation: Content + attributes: + user: + login: Login + password: Password + lastname: Name + firstname: First name + city: + majname: Uppercase name + postalcode: Zip code + inseecode: INSEE code + regioncode: Region code + lug: + related_region: Region + department: Department + url: Web address + city: City + event: + title: Title + start_time: Beginning + end_time: End + description: Description + address: Address + city: City + related_region: Region + locality: Scope + url: URL + contact: Contact + submitter: Submitter + submission_time: Waiting for + region: + name_values: + all: All regions + note: + contents: Your comment + i18n/backend/active_record/translation: + locale: Language + key: Key + value: Value + interpolations: Interpolations + is_proc: Procedure? diff --git a/config/locales/views/en.yml b/config/locales/views/en.yml new file mode 100644 index 00000000..6deb4fe2 --- /dev/null +++ b/config/locales/views/en.yml @@ -0,0 +1,310 @@ +en: + mail_prefix: "[AdL-en] " + show: View + save: Save + edit: Edit + validate: Validate + refuse: Refuse + destroy: Destroy + logout: Disconnect + + # Translatings screens + layouts: + application: + login: Authentication + title: L'Agenda du Libre + subtitle: The Free Software events + flag: Flag + france: France + quebec: Québec + belgique: Belgique + suisse: Suisse + propose: Propose an event + feeds: RSS/iCal feed + map: map + tags: Tags + infos: Informations + stats: Statistics + contact: Contact + moderation: Moderation + events: + index: + calendar_in: This calendar in %{rss}, %{webcal} or %{ical} + nb_events: "%{count} events" + show: + lug-list: Region's associations + add_to_calendar: Add to my calendar + at: At + dateAndPlace: Date and place + description: Description + infos: Informations + actions: Actions + edit: Edit event + cancel: Cancel event + html: + at: At + dateAndPlace: Date and place + description: Description + infos: Informations + new: + title: Propose an event + preview: Previsualisation + edit: Edition + create: + ok: Your event was added to the lists of events waiting for moderation. + It will appear online as soon as a moderator validates it. + edit: + title: Edit an event + warning: Warning, this event is already moderated. Any modification will + be immediately visible on the site. + forbidden: You are not authorised to modify this event + preview: Previsualisation + edit: Edition + preview: + warning: Warning, this event is already moderated. Any modification will + be immediately visible on the site. + update: + ok: Your event was updated + form: + save: Validate + visualise: Visualise + cancel: + title: Cancel event + already_moderated: Warning, this event is already moderated. This + cancellation will remove it from Agenda du Libre. + confirm: Do you confirm this event cancellation? + preview: Event visualisation + ok: Yes + ko: No + destroy: + ok: Your event was canceled + regions: + selector: + all_regions: All regions + index: + title: Feeds + quick: Each feed lists events for the coming 30 days in a given region. + If you subscribe to a regional feed, you will receive data on this + region's events, but also for all national events, like RMLL. + help: "Some interesting features: +\n +\n* You can limit events to a specific tag, through the `tag` parameter. This +will for example let you get a feed of all events organised by you association, +if you do remember to tag all your events with a specific tag. \n +Example: `%{tag}` +\n* You can modify the 30 days limit with the parameter `daylimit`. \n +Example: `%{daylimit}`" + stats: + title: Statistics + all: Validated events + allModeration: Events waiting for validation + regional: Per region + city: Per city + city_conditions: Only cities where more than 3 events have been organised + are displayed. + dates: Per date + web: Web statistics + webalizer: Statistics generated by Webalizer [are + available](http://agendadulibre.org/stats/). They are protected by + login *stats*, password *Cuntipshaf6* to avoid *referer spam* + tags: + index: + title: Tags + limited: Only tags on more than one event are displayed in this list. + show: + title: Events + future: + zero: + one: "In the future, %{count} event:" + other: "In the future, %{count} evens:" + past: + zero: + one: "In the past, %{count} event:" + other: "In the past, %{count} events:" + moderations: + index: + title: Events to moderate + rules: Moderators, thanks for reading and taking notice of [moderation + recommandations](/application/rules). + actions: Actions + posted_by: Created by %{author} on %{date} + date: Date + askInfos: Ask informations + createNote: Add a note + edit: + title: Edit event + moderation: Moderation + warning: Warning, this event is already moderated. Any modification will + be immediately visible on the site. + preview: Previsualisation + edit: Edition + update: + ok: Updated events + validate: + title: Event validation + warning: Warning, this event is of national scope! + question: Do you confirm this event validation? + ok: Yes + ko: Moderation + accept: + ok: Event accepted + refuse: + title: Event rejection + motif: Motive + question: What motive do you wish to associate to this event's rejection? + ok: Reject + ko: Moderation + reason_r_1: Off-topic + reason_r_2: Not enough information + reason_r_3: Event already recorded + reason_r_4: Specific reason (specify) + reason_r_1_long: Nonetheless, the proposed event hasn't yet retained the + moderators' attention. As it were, the proposed event isn't about Free + Software, or does not relate to Free Software, or the link with Free + Software is not evident considering the current formulation, or this is + about an expensive event or formation. If the event does relate to Free + Software and this is not a paying formation, do not hesitate to submit + it again with a clearer description. + reason_r_2_long: "Your event is relevant to the Agenda du Libre, but +moderators think its description is not complete enough to be validated. +\n +\nDescription must be comprehensible by a newcomer to Free Software, and must +thus detail the meeting cause, the targeted audience, the role of the presented +Free Software, the date and place. Including if this is a recurring meeting, +don't hesitate to repeat each time these informations, they are important. +\n +\nWe strongly invite you to submit again this event with a more complete description." + reason_r_3_long: Your event is relevant to the Agenda du Libre, but is + already present there. + reason: Your reason + destroy: + ok: Event rejected + notes: + new: + back: Moderation + title: Add a moderation note + event: Events to moderate + create: + sendByMailWrap: "

Demand for complementary informations:

+
%{contents}
" + ok: The note was added, thanks! + form: + save: Submit + ok: Save + ko: Cancel + maps: + index: + title: Events map + events: Events + lugs: Association + users: + sign_in: + title: Authentication + lugs: + search: + title: Find your %{entity}! + label: Search + + devise: + sessions: + new: + title: Authentication + sign_in: Identify + + event_mailer: + create: + subject: "Your event: '%{subject}' is waiting for moderation" + title: Hello, + body: "Your event titled '%{subject}', +\nwhich will take place on the '%{start_time}' has been recorded in the Agenda +du Libre. +\n +\nThe moderation team will take charge of it very soon. +\n +\nMeanwhile, and later if your event is accepted, you can edit it the address:" + delete_link: "and you can cancel it using the address:" + signature: "Thanks for your participation! +\n +\n-- +\nAgenda du Libre" + accept: + subject: "Event '%{subject}' moderated" + title: Hello, + body: "The event you submitted was moderated by %{moderator}. It is now + visible in the Agenda at the address:" + edit_link: "You can modify this event later to add details at the + address:" + delete_link: "You can can also cancel it at the address:" + signature: "Thank you for your contribution at the Agenda du Libre and +see you soon! +\n +\n-- +\nThe moderation team" + destroy: + subject: "Event '%{subject}' refused" + title: Hello, + body: You have submitted the following event in the Agenda du Libre, and + we thank you for this contribution. + reminder: "Reminder, here is your event's content:" + reclamation: For any reclamation, don't hesitate to contact the + moderation team. + signature: "With all our thanks for your contribution, +\n +\n-- +\nThe moderation team" + moderation_mailer: + create: + subject: "New event to moderate: '%{subject}'" + title: Hello, + body: A new event is to be moderated on + signature: "Thank you! +\n +\n-- +\nAgenda du Libre" + update: + subject: "Event '%{subject}' edition" + title: Hello, + body: "Event '%{subject}' has been modified by + %{author}. +\n +\nModifications:" + submitter: the submitter + signature: "Have a good day +\n +\n-- +\nThe moderation team" + accept: + subject: "Event '%{subject}' moderated" + title: Hello, + body: The event has been moderated by %{author}. + access: "You can consult it here:" + signature: "-- +\nThe moderation team" + destroy: + subject: "Event '%{subject}' refused" + title: Hello, + body: "The event '%{subject}' was rejected by %{author} for the following reason: +\n +\n" + reminder: "The event:" + signature: "-- +\nThe Agenda du Libre moderation team" + note_mailer: + notify: + subject: "Demand for more information on event '%{subject}'" + title: Hello, + body: "We have received your event proposal '%{subject}', +\nit is relevant to the Agenda du Libre. Nonetheless, before acceptation we +\nneed some supplementary informations:" + edit_link: "We invite you to directly add these informations to the +\nevent at the following address:" + signature: "With all our thanks for your contribution, +\n +\n-- +\nThe Agenda du Libre moderation team" + create: + subject: "A note was added to event '%{subject}'" + title: Hello, + body: "A comment was added to '%{subject}':" + signature: "-- +\nModeration team" diff --git a/config/locales/views/fr.yml b/config/locales/views/fr.yml index aa487858..e9aa0d5c 100644 --- a/config/locales/views/fr.yml +++ b/config/locales/views/fr.yml @@ -1,4 +1,5 @@ fr: + mail_prefix: "[AdL] " show: Voir save: Enregistrer edit: Éditer @@ -10,8 +11,9 @@ fr: # Traductions des écrans layouts: application: - login: Authentication + login: Authentification title: L'Agenda du Libre + subtitle: Les événements du Libre flag: Drapeau france: France quebec: Québec @@ -84,14 +86,17 @@ fr: title: Liste des flux quick: Chaque flux liste les évènements pour les 30 prochains jours en cours dans une région donnée. En vous abonnant à un flux régional, vous - recevrez des informations sur les évènements de votre région à portée - locale, mais également les évènements à portée nationale comme les - RMLL. + recevrez des informations sur les évènements de votre région, mais + également les évènements à portée nationale comme les RMLL. help: "Quelques fonctionnalités intéressantes:\n \n -* Vous pouvez limiter les évènements à un certain tag, en passant le paramètre `tag`. Cela permet par exemple de récupérer un flux des évènements organisés uniquement par votre association, à partir du moment où vous pensez à marquer tous vos évènements avec un tag précis. \n +* Vous pouvez limiter les évènements à un certain tag, en passant le paramètre +`tag`. Cela permet par exemple de récupérer un flux des évènements organisés +uniquement par votre association, à partir du moment où vous pensez à marquer +tous vos évènements avec un tag précis. \n Exemple: `%{tag}`\n -* Vous pouvez modifier la limite aux 30 prochains jours des flux en utilisant le paramètre `daylimit`. \n +* Vous pouvez modifier la limite des 30 prochains jours des flux en utilisant +le paramètre `daylimit`. \n Exemple: `%{daylimit}`" stats: title: Statistiques @@ -170,7 +175,7 @@ Exemple: `%{daylimit}`" Libre, mais les modérateurs trouvent que la description de celui-ci n'est pas assez complète pour être validée.\n\nLa description doit être compréhensible par un nouveau venu dans le monde du Libre, et doit donc - préciser le principe de la rencontre, le public visé, la rôle du ou des + préciser le principe de la rencontre, le public visé, le rôle du ou des Logiciels Libres qui seront exposés, la date et le lieu précis de la rencontre. Même si il s'agit d'une rencontre régulière, n'hésitez pas à répéter à chaque fois ces informations, elles sont importantes.\n\nNous @@ -185,7 +190,6 @@ Exemple: `%{daylimit}`" new: back: Modération title: Ajout d'une note de modération - event: Événements à modérer create: sendByMailWrap: "

Demande d'informations complémentaires:

@@ -222,11 +226,16 @@ Exemple: `%{daylimit}`" body: "Votre événement intitulé '%{subject}', \nqui aura lieu le '%{start_time}' a bien été enregistré dans l'Agenda du Libre. -\n\nL'équipe de modération le prendra en charge très prochainement. -\n\nPendant la modération et après celle-ci si votre événement est validé, vous +\n +\nL'équipe de modération le prendra en charge très prochainement. +\n +\nPendant la modération et après celle-ci si votre événement est validé, vous pouvez éditer votre événement à l'adresse:" delete_link: "et vous pouvez l'annuler en utilisant l'adresse:" - signature: "Merci de votre participation!\n\n-- \nAgenda du Libre" + signature: "Merci de votre participation! +\n +\n-- +\nAgenda du Libre" accept: subject: "Événement '%{subject}' modéré" title: Bonjour, @@ -237,7 +246,10 @@ pouvez éditer votre événement à l'adresse:" delete_link: "Vous pouvez également l'annuler en vous rendant à l'adresse:" signature: "Merci de votre contribution à l'Agenda du Libre et à - bientôt!\n\n-- \nL'équipe de modération" + bientôt! +\n +\n-- +\nL'équipe de modération" destroy: subject: "Événement '%{subject}' refusé" title: Bonjour, @@ -246,34 +258,44 @@ pouvez éditer votre événement à l'adresse:" reminder: "Pour rappel, voici le contenu de votre événement:" reclamation: Pour toute réclamation, n'hésitez pas à contacter l'équipe de modérateurs. - signature: "Avec tous nos remerciements pour votre contribution,\n\n-- - \nL'équipe de modération" + signature: "Avec tous nos remerciements pour votre contribution, +\n +\n-- +\nL'équipe de modération" moderation_mailer: create: subject: "Nouvel événement à modérer: '%{subject}'" title: Bonjour, body: Un nouvel événement est à modérer sur - signature: "Merci!\n\n-- \nAgenda du Libre" + signature: "Merci! +\n +\n-- +\nAgenda du Libre" update: subject: "Édition de l'événement '%{subject}'" title: Bonjour, body: "L'événement '%{subject}' a été modifié par %{author}.\n\nModifications apportées:" submitter: le soumetteur - signature: "Bonne journée\n\n-- \nL'équipe de modération" + signature: "Bonne journée +\n +\n-- +\nL'équipe de modération" accept: subject: "Événement '%{subject}' modéré" title: Bonjour, body: L'événement a été modéré par %{author}. access: "Vous pouvez le consulter ici:" - signature: "-- \nL'équipe de modération" + signature: "-- +\nL'équipe de modération" destroy: subject: "Événement '%{subject}' refusé" title: Bonjour, body: "L'événement '%{subject}' a été rejeté par %{author} pour la raison suivante:\n\n" reminder: "Pour rappel, l'événement:" - signature: "-- \nL'équipe des modérateurs de l'Agenda du Libre" + signature: "-- +\nL'équipe des modérateurs de l'Agenda du Libre" note_mailer: notify: subject: "Demande d'informations sur l'événement '%{subject}'" @@ -284,10 +306,13 @@ pouvez éditer votre événement à l'adresse:" \ncomplémentaires sur cet événement:" edit_link: "Nous vous invitons à ajouter ces informations en éditant directement \nl'événement à l'adresse suivante:" - signature: "Avec tous nos remerciements pour votre contribution,\n\n-- - \nL'équipe des modérateurs de l'Agenda du Libre" + signature: "Avec tous nos remerciements pour votre contribution, +\n +\n-- +\nL'équipe des modérateurs de l'Agenda du Libre" create: subject: "Une note a été rajoutée à l'événement '%{subject}'" title: Bonjour, body: "Une note a été rajoutée à '%{subject}':" - signature: "-- \nL'équipe de modération" + signature: "-- +\nL'équipe de modération"