aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/initializers/i18n.rb164
-rw-r--r--config/locales/actions.en.yml1
-rw-r--r--config/locales/actions.fr.yml1
-rw-r--r--config/locales/calendars.en.yml1
-rw-r--r--config/locales/calendars.fr.yml1
-rw-r--r--config/locales/en.yml1
-rw-r--r--config/locales/export_messages.en.yml1
-rw-r--r--config/locales/export_messages.fr.yml1
-rw-r--r--config/locales/exports.en.yml4
-rw-r--r--config/locales/exports.fr.yml2
-rw-r--r--config/locales/fr.yml1
-rw-r--r--config/locales/journey_patterns.en.yml1
-rw-r--r--config/locales/journey_patterns.fr.yml1
-rw-r--r--config/locales/lines.en.yml4
-rw-r--r--config/locales/lines.fr.yml4
-rw-r--r--config/locales/referentials.fr.yml2
-rw-r--r--config/locales/vehicle_journeys.en.yml1
-rw-r--r--config/locales/vehicle_journeys.fr.yml1
-rw-r--r--config/locales/workbenches.en.yml5
-rw-r--r--config/locales/workbenches.fr.yml4
-rw-r--r--config/routes.rb1
-rw-r--r--config/secrets.yml2
-rw-r--r--config/secrets.yml.docker1
23 files changed, 196 insertions, 9 deletions
diff --git a/config/initializers/i18n.rb b/config/initializers/i18n.rb
new file mode 100644
index 000000000..fdf5d6c04
--- /dev/null
+++ b/config/initializers/i18n.rb
@@ -0,0 +1,164 @@
+module I18n
+ class << self
+ def translate_with_fallback key, options={}, original=nil
+ options[:locale] ||= I18n.locale
+ begin
+ self.translate_without_fallback(key, {raise: true}.update(options))
+ rescue => e
+ split = key.to_s.split('.')
+ if split.size <= 2
+ translate_without_fallback original || key, options
+ else
+ v = split.pop
+ v2 = split.pop
+ split.pop if v2 == "default"
+ split << "default" << v
+ new_key = split.join('.')
+ translate_with_fallback new_key, options, original || key
+ end
+ end
+ end
+ alias_method_chain :translate, :fallback
+ alias_method :t, :translate
+ end
+
+ def self.tc(key, params={})
+ self.t('label_with_colon', label: key.t(params)).html_safe
+ end
+
+ def self.tmf(key, params={})
+ model, col = key.split "."
+ begin
+ self.t "activerecord.attributes.#{key}", {raise: true}.update(params)
+ rescue
+ begin
+ self.t "activerecord.attributes.common.#{col}", {raise: true}.update(params)
+ rescue
+ begin
+ self.t "simple_form.labels.#{key}", {raise: true}.update(params)
+ rescue
+ "activerecord.attributes.#{key}".t params
+ end
+ end
+ end
+ end
+
+ def self.tmfc(key, params={})
+ self.t('label_with_colon', label: self.tmf(key, params)).html_safe
+ end
+
+ def self.missing_keys_logger
+ @@my_logger ||= Logger.new("#{Rails.root}/log/missing_keys.log")
+ end
+
+ def self.log_missing_key key, params={}
+ missing_keys_logger.info "key: '#{key}', locale: '#{I18n.locale}', params: #{params}"
+ end
+
+ def self.t_with_default(key, params={})
+ begin
+ self.t(key, {raise: true}.update(params))
+ rescue
+ if Rails.env.development?
+ log_missing_key key, params
+ "<span class='label label-danger' title='#{self.t(key, params)}'>!</span>#{key.split('.').last}".html_safe
+ else
+ key.split('.').last
+ end
+ end
+ end
+end
+
+module EnhancedI18n
+ def t(params={})
+ I18n.t_with_default(self, params)
+ end
+
+ def tc(params={})
+ I18n.tc(self, params)
+ end
+
+ def tmf(params={})
+ I18n.tmf(self, params)
+ end
+
+ def tmfc(params={})
+ I18n.tmfc(self, params)
+ end
+end
+
+module EnhancedTimeI18n
+ def l(params={})
+ I18n.l(self, params)
+ end
+end
+
+class Symbol
+ include EnhancedI18n
+end
+
+class String
+ include EnhancedI18n
+end
+
+class Time
+ include EnhancedTimeI18n
+end
+
+class DateTime
+ include EnhancedTimeI18n
+end
+
+class Date
+ include EnhancedTimeI18n
+end
+
+module EnhancedModelI18n
+ # Human name of the class (plural)
+ def t opts={}
+ "activerecord.models.#{i18n_key}".t({count: 2}.update(opts))
+ end
+
+ # Human name of the class (singular)
+ def ts opts={}
+ self.t({count: 1}.update(opts))
+ end
+
+ # Human name of the class (with comma)
+ def tc(params={})
+ I18n.tc(i18n_key, params)
+ end
+
+ # Human name of the attribute
+ def tmf(attribute, params={})
+ I18n.tmf "#{i18n_key}.#{attribute}", params
+ end
+
+ # Translate the given action on the model, with default
+ def t_action(action, params={})
+ key = case action.to_sym
+ when :create
+ :new
+ when :update
+ :edit
+ else
+ action
+ end
+
+ begin
+ I18n.translate_without_fallback "#{i18n_key.pluralize}.#{key}.title", ({raise: true}.update(params))
+ rescue
+ I18n.translate_without_fallback "#{key}.title", params
+ end
+ end
+
+ private
+ def i18n_key
+ model_name.to_s.underscore.gsub('/', '_')
+ end
+
+end
+
+class ActiveRecord::Base
+ extend EnhancedModelI18n
+end
diff --git a/config/locales/actions.en.yml b/config/locales/actions.en.yml
index 278915526..04f4aca6b 100644
--- a/config/locales/actions.en.yml
+++ b/config/locales/actions.en.yml
@@ -5,6 +5,7 @@ en:
deactivate: 'Deactivate'
destroy: "Destroy"
delete: "Delete"
+ download: 'Download'
search: "Search"
submit: "Submit"
processing: "Processing…"
diff --git a/config/locales/actions.fr.yml b/config/locales/actions.fr.yml
index 92e16f21e..88e08aaef 100644
--- a/config/locales/actions.fr.yml
+++ b/config/locales/actions.fr.yml
@@ -5,6 +5,7 @@ fr:
deactivate: 'Désactiver'
destroy: 'Supprimer'
delete: 'Supprimer'
+ download: 'Télécharger'
search: "Chercher"
submit: "Valider"
processing: "En cours…"
diff --git a/config/locales/calendars.en.yml b/config/locales/calendars.en.yml
index c3df413af..b9540d124 100644
--- a/config/locales/calendars.en.yml
+++ b/config/locales/calendars.en.yml
@@ -64,7 +64,6 @@ en:
attributes:
calendar:
name: Name
- short_name: Short name
date_ranges: Date ranges
dates: Dates
shared: Shared
diff --git a/config/locales/calendars.fr.yml b/config/locales/calendars.fr.yml
index 6fd265925..6a87a889a 100644
--- a/config/locales/calendars.fr.yml
+++ b/config/locales/calendars.fr.yml
@@ -64,7 +64,6 @@ fr:
attributes:
calendar:
name: Nom
- short_name: Nom court
date_ranges: Intervalles de dates
dates: Dates
shared: Partagé
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 8af8067db..05d21a1f2 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -2,6 +2,7 @@ en:
"true": "Yes"
"false": "No"
"unknown": "Unknown"
+ label_with_colon: "%{label}: "
time:
diff --git a/config/locales/export_messages.en.yml b/config/locales/export_messages.en.yml
index f7951a103..9823d7f78 100644
--- a/config/locales/export_messages.en.yml
+++ b/config/locales/export_messages.en.yml
@@ -1,3 +1,4 @@
en:
export_messages:
success: Success
+ no_matching_journey: No matching journey found
diff --git a/config/locales/export_messages.fr.yml b/config/locales/export_messages.fr.yml
index 5c2191f35..4f45fd8e1 100644
--- a/config/locales/export_messages.fr.yml
+++ b/config/locales/export_messages.fr.yml
@@ -1,3 +1,4 @@
fr:
export_messages:
success: Succès
+ no_matching_journey: Aucun trajet correspondant
diff --git a/config/locales/exports.en.yml b/config/locales/exports.en.yml
index 88c1b99f8..de34e797c 100644
--- a/config/locales/exports.en.yml
+++ b/config/locales/exports.en.yml
@@ -84,7 +84,11 @@ en:
max_distance_for_connection_link: "Max distance for connection link"
ignore_last_word: "ignore last word"
ignore_end_chars: "ignore last chars"
+ type: "Export type"
+ file: "Output"
+ files: "Outputs"
parent: Parent
+ referential_id: Referential
export:
<<: *attrs
base:
diff --git a/config/locales/exports.fr.yml b/config/locales/exports.fr.yml
index fa3ac8fc7..62aae70cd 100644
--- a/config/locales/exports.fr.yml
+++ b/config/locales/exports.fr.yml
@@ -86,7 +86,9 @@ fr:
ignore_end_chars: "ignorer les n derniers caractères"
type: "Type d'export"
file: "Résultat"
+ files: "Résultats"
parent: Parent
+ referential_id: Jeu de données
export:
<<: *attrs
base:
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index e1f52ff55..733ba05b9 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -2,6 +2,7 @@ fr:
"true": "Oui"
"false": "Non"
"unknown": "Non précisé"
+ label_with_colon: "%{label} : "
time:
formats:
diff --git a/config/locales/journey_patterns.en.yml b/config/locales/journey_patterns.en.yml
index 5f3de0b05..d480e144d 100644
--- a/config/locales/journey_patterns.en.yml
+++ b/config/locales/journey_patterns.en.yml
@@ -41,7 +41,6 @@ en:
name: "Name"
published_name: "Published name"
comment: "Comments"
- section_status: "Section status"
registration_number: "Registration number"
stop_point_ids: "Route's stop selection"
objectid: "Neptune identifier"
diff --git a/config/locales/journey_patterns.fr.yml b/config/locales/journey_patterns.fr.yml
index 2aa95248f..32c1f3f97 100644
--- a/config/locales/journey_patterns.fr.yml
+++ b/config/locales/journey_patterns.fr.yml
@@ -40,7 +40,6 @@ fr:
route: "Séquence d'arrêts"
name: "Nom"
published_name: "Nom public"
- section_status: "Status section"
comment: "Commentaire"
registration_number: "Code mission"
stop_point_ids: "Sélection des arrêts desservis"
diff --git a/config/locales/lines.en.yml b/config/locales/lines.en.yml
index 8e0189bd8..e61013725 100644
--- a/config/locales/lines.en.yml
+++ b/config/locales/lines.en.yml
@@ -83,7 +83,6 @@ en:
name: "Name"
published_name: "Published name"
registration_number: "Short name"
- deactivated: "Activated"
number: "Number"
transport_mode: "Transport mode"
transport_submode: "Transport Submode"
@@ -116,6 +115,9 @@ en:
creator_id: "Created by"
footnotes: "Footnotes"
stable_id: External permanent idenifier"
+ state: State
+ activated: Activated
+ deactivated: Deactivated
formtastic:
titles:
line:
diff --git a/config/locales/lines.fr.yml b/config/locales/lines.fr.yml
index 2159f06ab..d3069f1d1 100644
--- a/config/locales/lines.fr.yml
+++ b/config/locales/lines.fr.yml
@@ -81,7 +81,6 @@ fr:
companies:
name: "Transporteur principal"
registration_number: "Nom court"
- deactivated: "Activé"
name: "Nom de la ligne"
published_name: "Nom public"
number: "Numéro"
@@ -116,6 +115,9 @@ fr:
creator_id: "Créé par"
footnotes: "Notes de bas de page"
stable_id: "Identifiant externe pérenne"
+ state: État
+ activated: Activée
+ deactivated: Désactivée
formtastic:
titles:
line:
diff --git a/config/locales/referentials.fr.yml b/config/locales/referentials.fr.yml
index 53183a4c2..ec6c7c643 100644
--- a/config/locales/referentials.fr.yml
+++ b/config/locales/referentials.fr.yml
@@ -32,7 +32,7 @@ fr:
title: 'Dupliquer un jeu de données'
submit: "Valider"
select_compliance_control_set:
- title: "Sélection du jeu de contôle"
+ title: "Sélection du jeu de contôles"
actions:
new: "Créer un jeu de données"
destroy_confirm: "Etes vous sûr de vouloir supprimer ce jeu de données ?"
diff --git a/config/locales/vehicle_journeys.en.yml b/config/locales/vehicle_journeys.en.yml
index 1fa2618dd..f1ba96dc5 100644
--- a/config/locales/vehicle_journeys.en.yml
+++ b/config/locales/vehicle_journeys.en.yml
@@ -126,7 +126,6 @@ en:
purchase_window: "Purchase availability"
regular_fs: "Regular service"
route: "Route"
- status_value: "Status Value"
time_slot: "Time Slot"
time_table_ids: "Calendar list"
time_tables: "Calendars"
diff --git a/config/locales/vehicle_journeys.fr.yml b/config/locales/vehicle_journeys.fr.yml
index a1eb5b3f7..d144e580f 100644
--- a/config/locales/vehicle_journeys.fr.yml
+++ b/config/locales/vehicle_journeys.fr.yml
@@ -127,7 +127,6 @@ fr:
purchase_window: "Disponibilité commerciale"
regular_fs: "Service régulier"
route: "Itinéraire"
- status_value: "Etat de trafic"
time_slot: "Fréquence"
time_table_ids: "Liste des calendriers"
time_tables: "Calendriers"
diff --git a/config/locales/workbenches.en.yml b/config/locales/workbenches.en.yml
index 2d9b27045..b11f35049 100644
--- a/config/locales/workbenches.en.yml
+++ b/config/locales/workbenches.en.yml
@@ -29,3 +29,8 @@ en:
zero: "workbench"
one: "workbench"
other: "workbenches"
+ attributes:
+ workbench:
+ import_compliance_control_set_id: Space data before import
+ merge_compliance_control_set_id: Space data before merge
+
diff --git a/config/locales/workbenches.fr.yml b/config/locales/workbenches.fr.yml
index 8eee1a516..d7e3327ac 100644
--- a/config/locales/workbenches.fr.yml
+++ b/config/locales/workbenches.fr.yml
@@ -29,3 +29,7 @@ fr:
zero: "espace de travail"
one: "espace de travail"
other: "espaces de travail"
+ attributes:
+ workbench:
+ import_compliance_control_set_id: Jeu de données après import
+ merge_compliance_control_set_id: Jeu de Données avant intégration
diff --git a/config/routes.rb b/config/routes.rb
index 6313b5678..25105241a 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -74,6 +74,7 @@ ChouetteIhm::Application.routes.draw do
member do
get 'edit_boarding_alighting'
put 'save_boarding_alighting'
+ get 'costs'
post 'duplicate', to: 'routes#duplicate'
end
resource :journey_patterns_collection, :only => [:show, :update]
diff --git a/config/secrets.yml b/config/secrets.yml
index 0de3fd6ef..963bacd36 100644
--- a/config/secrets.yml
+++ b/config/secrets.yml
@@ -18,6 +18,7 @@ development:
# geoportail_api_key: "aaaaaaaaaaaaaaaaaaaaaa"
newrelic_licence_key: ""
osrm_endpoint: "http://router.project-osrm.org"
+ tomtom_api_key: ""
test:
secret_key_base: 54f61aab23322611dd0bbf73b7f034db34281f7f4b3c4992eaaff20ecc9673bbd467beaa6fcb48379ca69b80bc5662deac4e33ca144f2482146123d3e966016a
@@ -37,3 +38,4 @@ production:
# geoportail_api_key: "aaaaaaaaaaaaaaaaaaaaaa"
newrelic_licence_key: ""
osrm_endpoint: "http://router.project-osrm.org"
+ tomtom_api_key: ""
diff --git a/config/secrets.yml.docker b/config/secrets.yml.docker
index f9bbf5fa0..e35dd3d33 100644
--- a/config/secrets.yml.docker
+++ b/config/secrets.yml.docker
@@ -15,3 +15,4 @@
api_endpoint: <%= ENV.fetch 'IEV_API_ENDPOINT', 'http://iev:8080/chouette_iev/' %>
api_token: <%= ENV.fetch 'IEV_API_TOKEN', 'change this according to IEV configuration' %>
newrelic_licence_key: <%= ENV.fetch 'NR_LICENCE_KEY', 'will_not_work' %>
+ tomtom_api_key: <%= ENV.fetch 'TOMTOM_API_KEY', 'will_not_work' %>