Commit 8c810237481c42db07facb90e89c0f6b1d68e895

Authored by Rafael Manzo
1 parent f6cf6d06

KalibroConfiguration internationalization

config/application.rb modified to recusirvely search locales
app/controllers/kalibro_configurations_controller.rb
... ... @@ -80,7 +80,7 @@ class KalibroConfigurationsController < ApplicationController
80 80 if @kalibro_configuration.save
81 81 current_user.kalibro_configuration_ownerships.create kalibro_configuration_id: @kalibro_configuration.id
82 82  
83   - format.html { redirect_to kalibro_configuration_path(@kalibro_configuration.id), notice: t('successfully_created', :record => t(@kalibro_configuration.class.name)) }
  83 + format.html { redirect_to kalibro_configuration_path(@kalibro_configuration.id), notice: t('successfully_created', :record => t(@kalibro_configuration.model_name.human)) }
84 84 format.json { render action: 'show', status: :created, location: @kalibro_configuration }
85 85 else
86 86 format.html { render action: 'new' }
... ...
app/views/kalibro_configurations/_form.html.erb
... ... @@ -22,8 +22,8 @@
22 22 </div>
23 23  
24 24 <div class="row margin-left-none" style="margin-top: 20px">
25   - <%= f.submit 'Save', class: 'btn btn-primary' %>
26   - <%= link_to 'Back', kalibro_configurations_path, class: 'btn btn-default' %>
  25 + <%= f.submit t('save'), class: 'btn btn-primary' %>
  26 + <%= link_to t('back'), kalibro_configurations_path, class: 'btn btn-default' %>
27 27 </div>
28 28  
29 29 <% end %>
... ...
app/views/kalibro_configurations/_kalibro_configuration.html.erb
1 1 <tr>
2 2 <td><%= kalibro_configuration.name %></td>
3 3 <td><%= kalibro_configuration.description %></td>
4   - <td><%= link_to 'Show', kalibro_configuration_path(kalibro_configuration.id), class: 'btn btn-info' %></td>
  4 + <td><%= link_to t('show'), kalibro_configuration_path(kalibro_configuration.id), class: 'btn btn-info' %></td>
5 5 <td>
6 6 <% if kalibro_configuration_owner?(kalibro_configuration.id) %>
7   - <%= link_to 'Edit', edit_kalibro_configuration_path(kalibro_configuration.id), class: 'btn btn-info' %>
  7 + <%= link_to t('edit'), edit_kalibro_configuration_path(kalibro_configuration.id), class: 'btn btn-info' %>
8 8 <% end %>
9 9 </td>
10 10 </tr>
11 11 \ No newline at end of file
... ...
app/views/kalibro_configurations/_list.html.erb
1 1 <table class="table table-hover">
2 2 <thead>
3 3 <tr>
4   - <th>Name</th>
5   - <th>Description</th>
  4 + <th><%= t('name') %></th>
  5 + <th><%= t('description') %></th>
6 6 <th colspan="2"></th>
7 7 </tr>
8 8 </thead>
... ...
app/views/kalibro_configurations/_metric_configurations.html.erb
... ... @@ -10,7 +10,7 @@
10 10 <%= link_to_edit_form(metric_configuration, @kalibro_configuration.id) %>
11 11 </td>
12 12 <td>
13   - <%= link_to 'Destroy', kalibro_configuration_metric_configuration_path(@kalibro_configuration.id, metric_configuration.id),
  13 + <%= link_to t('destroy'), kalibro_configuration_metric_configuration_path(@kalibro_configuration.id, metric_configuration.id),
14 14 method: :delete, data: { confirm: 'Are you sure that you want to destroy this Metric Configuration?' },
15 15 class: 'btn btn-danger' %>
16 16 </td>
... ...
app/views/kalibro_configurations/_no_metric_configurations.html.erb
1 1 <tr>
2 2 <% col_number = kalibro_configuration_owner?(@kalibro_configuration.id) ? 5 : 3 %>
3   - <td colspan="<%= col_number %>">There are no Metric Configurations yet!</td>
  3 + <td colspan="<%= col_number %>"><%= t('no_metric_configurations') %></td>
4 4 </tr>
5 5 \ No newline at end of file
... ...
app/views/kalibro_configurations/edit.html.erb
1   -<h1>Edit Configuration</h1>
  1 +<h1><%= "#{t('edit')} #{KalibroConfiguration.model_name.human}" %></h1>
2 2  
3 3 <%= render 'form' %>
... ...
app/views/kalibro_configurations/index.html.erb
1 1 <div class="page-header">
2   - <h1>Configurations</h1>
  2 + <h1><%= KalibroConfiguration.model_name.human(count: 2) %></h1>
3 3 </div>
4 4  
5 5 <% if user_signed_in? %>
6 6 <p>
7   - <%= link_to 'New Configuration', new_kalibro_configuration_path, class: 'btn btn-primary' %>
  7 + <%= link_to "#{t('new.female')} #{KalibroConfiguration.model_name.human}", new_kalibro_configuration_path, class: 'btn btn-primary' %>
8 8 </p>
9 9 <%else%>
10 10 <p class="alert alert-warning alert-dismissable">
11 11 <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
12   - You must be logged in to create new Configurations.
  12 + <%= t('unauthenticated', action: "#{t('create').downcase} #{KalibroConfiguration.model_name.human(count: 2).downcase}") %>.
13 13 </p>
14 14 <% end %>
15 15  
... ...
app/views/kalibro_configurations/new.html.erb
1   -<h1>New Configuration</h1>
  1 +<h1><%= "#{t('new.female')} #{KalibroConfiguration.model_name.human}" %></h1>
2 2  
3 3 <%= render 'form' %>
... ...
app/views/kalibro_configurations/show.html.erb
... ... @@ -3,23 +3,23 @@
3 3 </div>
4 4  
5 5 <p>
6   - <strong>Description:</strong>
  6 + <strong><%= t('description') %>:</strong>
7 7 <%= @kalibro_configuration.description %>
8 8 </p>
9 9  
10 10 <hr>
11 11  
12   -<h2> Metrics </h2>
  12 +<h2><%= t('metric').pluralize %></h2>
13 13 <% if kalibro_configuration_owner? @kalibro_configuration.id %>
14   - <%= link_to 'Add Metric', kalibro_configuration_choose_metric_path(@kalibro_configuration.id), class: 'btn btn-info' %>
  14 + <%= link_to "#{t('add')} #{t('metric')}", kalibro_configuration_choose_metric_path(@kalibro_configuration.id), class: 'btn btn-info' %>
15 15 <% end %>
16 16  
17 17 <table class="table table-hover">
18 18 <thead>
19 19 <tr>
20   - <th>Metric Name</th>
21   - <th>Code</th>
22   - <th>Weight</th>
  20 + <th><%= "#{t('metric')} #{t('name')}" %></th>
  21 + <th><%= t('code') %></th>
  22 + <th><%= t('weight') %></th>
23 23 <th colspan="3"></th>
24 24 </tr>
25 25 </thead>
... ... @@ -35,8 +35,8 @@
35 35 <hr>
36 36  
37 37 <p>
38   - <%= link_to 'Back', kalibro_configurations_path, class: 'btn btn-default' %>
  38 + <%= link_to t('back'), kalibro_configurations_path, class: 'btn btn-default' %>
39 39 <% if kalibro_configuration_owner? @kalibro_configuration.id %>
40   - <%= link_to 'Destroy Configuration', kalibro_configuration_path(@kalibro_configuration.id), method: :delete, data: { confirm: 'Are you sure that you want to destroy this Configuration?' }, class: 'btn btn-danger' %>
  40 + <%= link_to "#{t('destroy')} #{KalibroConfiguration.model_name.human}", kalibro_configuration_path(@kalibro_configuration.id), method: :delete, data: { confirm: 'Are you sure that you want to destroy this Configuration?' }, class: 'btn btn-danger' %>
41 41 <% end %>
42 42 </p>
... ...
config/application.rb
... ... @@ -17,7 +17,7 @@ module Mezuro
17 17 # config.time_zone = 'Central Time (US & Canada)'
18 18  
19 19 # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
20   - config.i18n.load_path += Dir[Rails.root.join('config', 'locales/*', '*.{rb,yml}').to_s]
  20 + config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s]
21 21 # config.i18n.default_locale = :de
22 22 config.i18n.enforce_available_locales = true
23 23  
... ...
config/locales/default/en.yml
... ... @@ -30,5 +30,8 @@ en:
30 30 Repository: "Repository"
31 31 Project: "Project"
32 32 Reading: "Reading"
  33 + metric: 'Metric'
33 34  
34 35 compound: "Compound"
  36 +
  37 + unauthenticated: "You must be logged in to %{action}"
... ...
config/locales/default/pt.yml
... ... @@ -9,5 +9,8 @@ pt:
9 9 Repository: "Repositório"
10 10 Project: "Projeto"
11 11 Reading: "Leitura"
  12 + metric: 'Métrica'
12 13  
13 14 compound: "Composta"
  15 +
  16 + unauthenticated: "Você precisa fazer login para %{action}"
... ...
config/locales/views/en.yml
... ... @@ -20,7 +20,7 @@
20 20 # available at http://guides.rubyonrails.org/i18n.html.
21 21  
22 22 en:
23   - #commons
  23 + #commons
24 24 home: "Home"
25 25 hello: "Hello"
26 26 sign_out: "Sign Out"
... ... @@ -55,7 +55,6 @@ en:
55 55 no_description: "There is no description available."
56 56 welcome: "Welcome"
57 57 metrics: "Metrics"
58   - metric: "Metric"
59 58 value: "Value"
60 59 threshold: "Threshold"
61 60 granularity: "Granularity"
... ... @@ -100,8 +99,12 @@ en:
100 99 month: "Month"
101 100 year: "Year"
102 101 search: "Search"
103   -
104   - #this pattern is type_folder_file
  102 + new:
  103 + male: 'New'
  104 + female: 'New'
  105 + create: 'Create'
  106 + add: 'Add'
  107 + #this pattern is type_folder_file
105 108  
106 109 about_mezuro: "About Mezuro"
107 110 about_mezuro_body: "<small> The Mezuro project attempts to provide a platform to compare projects and metric techniques, teaching how to use metrics through configurations and code analysis, avoid technical debts and disseminate code metrics usage and understanding.</small>"
... ... @@ -133,12 +136,12 @@ en:
133 136 metric_configurations_base_tool_name: "Base Tool Name:"
134 137 metric_configurations_aggregation: "Aggregation Form"
135 138 metric_configurations_reading_group: "Reading Group Name"
136   - created_metrics: "Created Metrics"
  139 + created_metrics: "Created Metrics"
137 140 resend_instruction: "Resend confirmation instructions"
138 141 confirm_account_email: "You can confirm your account email through the link below:"
139 142 request_change_password: "Someone has requested a link to change your password. You can do this through the link below:"
140 143 ignore_email: "If you did not request this, please ignore this email."
141   - password_not_change: "Your password will not change until you access the link above and create a new one."
  144 + password_not_change: "Your password will not change until you access the link above and create a new one."
142 145 account_locked: "Your account has been locked due to an excessive number of unsuccessful sign in attempts."
143 146 link_unlock_account: "Click the link below to unlock your account:"
144 147 change_password: "Change your password"
... ... @@ -235,7 +238,7 @@ en:
235 238 fill_name_unique: "Fill in the form with a name that must be unique"
236 239 description_required: "Fill in the form with a description which is not required"
237 240 click_save_project: "Click on 'Save' and you should be at the project page now, congratulations!"
238   - repository_creation: "Repository creation"
  241 + repository_creation: "Repository creation"
239 242 project_page_click_new_repository: "From the project page, click on New Repository"
240 243 fill_form: "Fill in the form"
241 244 name_must_unique: "Name' must be unique"
... ... @@ -249,7 +252,7 @@ en:
249 252 repository_divided_diferent_sections: "The repository page is divided into four different sections:"
250 253 provided_creation_steps: "Information that you provided during the creation steps"
251 254 visualize_processings_repository: "Select box so it is possible to visualize previous processings of your repository"
252   - processing_information: "Processing information"
  255 + processing_information: "Processing information"
253 256 time_finish_processing: "Information about the time it has taken to finish each step of the processing"
254 257 reserving_folder_repository: "PREPARING: the system is reserving a folder for your repository and retrieving the configuration"
255 258 retrieving_source_code: "DOWNLOADING: retrieving the source code"
... ...
config/locales/views/kalibro_configuration/en.yml 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +en:
  2 + activemodel:
  3 + models:
  4 + kalibro_configuration:
  5 + one: Configuration
  6 + other: Configurations
  7 + attributes:
  8 + kalibro_configuration:
  9 + name: 'Name'
  10 + description: 'Description'
0 11 \ No newline at end of file
... ...
config/locales/views/kalibro_configuration/pt.yml 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +pt:
  2 + activemodel:
  3 + models:
  4 + kalibro_configuration:
  5 + one: Configuração
  6 + other: Configurações
  7 + attributes:
  8 + kalibro_configuration:
  9 + name: 'Nome'
  10 + description: 'Descrição'
0 11 \ No newline at end of file
... ...
config/locales/views/pt.yml
... ... @@ -20,7 +20,7 @@
20 20 # available at http://guides.rubyonrails.org/i18n.html.
21 21  
22 22 pt:
23   - #commons
  23 + #commons
24 24 home: "Início"
25 25 hello: "Olá"
26 26 sign_out: "Sair"
... ... @@ -55,7 +55,6 @@ pt:
55 55 no_description: "Não há descrição disponível."
56 56 welcome: "Bem-Vindo"
57 57 metrics: "Métricas"
58   - metric: "Metrica"
59 58 value: "Valor"
60 59 threshold: "limite"
61 60 granularity: "Granularidade"
... ... @@ -97,8 +96,13 @@ pt:
97 96 month: "Mês"
98 97 year: "Ano"
99 98 search: "Procurar"
  99 + new:
  100 + male: 'Novo'
  101 + female: 'Nova'
  102 + create: 'Criar'
  103 + add: 'Adicionar'
100 104  
101   - #this pattern is type_folder_file
  105 + #this pattern is type_folder_file
102 106  
103 107 about_mezuro: "Sobre Mezuro"
104 108 about_mezuro_body: "<small> O projeto Mezuro tenta prover uma plataforma para comparar técnicas de projetos e métricas, ensinando como usar métricas através de configurações e análise de código, evitando débitos técnicos e disseminando o uso e entendimento de métricas de código.</small>"
... ... @@ -106,7 +110,7 @@ pt:
106 110 about_mezuro2: "A ideia é ser um serviço em que vocẽ pode avaliar a qualidade do seu código e, se você quiser, definir um conjunto de métricas a serem usadas."
107 111 title_home_index: "Entendendo Métricas de Código"
108 112 latest_projects_home_index: "Últimos projetos"
109   - body_home_index: "<p>Este é o Mezuro! Uma plataforma web <strong>livre</strong> para <strong>avaliação colaborativa</strong> de código fonte.</p> <p>Aqui você pode avaliar seu código fonte com os SCMs mais populares (como Git e SVN), apenas fornecendo sua URL. Por enquanto, você pode avaliar códigos em <strong>C</strong>, <strong>C++</strong> e <strong>Java</strong>, mas nós pretendemos dar suporte a mais linguagems no futuro.</p>"
  113 + body_home_index: "<p>Este é o Mezuro! Uma plataforma web <strong>livre</strong> para <strong>avaliação colaborativa</strong> de código fonte.</p> <p>Aqui você pode avaliar seu código fonte com os SCMs mais populares (como Git e SVN), apenas fornecendo sua URL. Por enquanto, você pode avaliar códigos em <strong>C</strong>, <strong>C++</strong> e <strong>Java</strong>, mas nós pretendemos dar suporte a mais linguagems no futuro.</p>"
110 114 body_feedback_home_index: "Mezuro está sob constante desenvolvimento. Experimente e nos dê o seu"
111 115 body1_compound_form: "Uma variável que contém o valor de um cálculo de métrica. Ele pode ser utilizado no script de outra métrica composta."
112 116 body1_compound_form_example: "Exemplo: Código foo := 10"
... ... @@ -134,7 +138,7 @@ pt:
134 138 confirm_account_email: "Você pode confirmar a sua conta de e-mail através do link abaixo:"
135 139 request_change_password: "Alguém pediu um link para alterar sua senha. Você pode fazer isso através do link abaixo:"
136 140 ignore_email: "Se você não solicitou este e-mail, por favor ignore-o."
137   - password_not_change: "Sua senha não será alterada até que você acesse o link acima e crie uma nova senha."
  141 + password_not_change: "Sua senha não será alterada até que você acesse o link acima e crie uma nova senha."
138 142 account_locked: "Sua conta foi bloqueada devido a um número excessivo de tentativas de login sem sucesso."
139 143 link_unlock_account: "Clique no link abaixo para desbloquear sua conta:"
140 144 change_password: "Mudando sua senha"
... ... @@ -230,7 +234,7 @@ pt:
230 234 fill_name_unique: "Preencha o formulário com um nome que deve ser único"
231 235 description_required: "Preencha o formulário com a descrição"
232 236 click_save_project: "Clique em Salvar. Agora você deve estar na página do projeto, parabéns!"
233   - repository_creation: "Criando um repositório"
  237 + repository_creation: "Criando um repositório"
234 238 project_page_click_new_repository: "A partir da página do projeto, clique em Novo Repositório"
235 239 fill_form: "Preencha o formulário"
236 240 name_must_unique: "O nome deve ser exclusivo"
... ... @@ -244,7 +248,7 @@ pt:
244 248 repository_divided_diferent_sections: "A página de repositório é dividida em quatro seções diferentes:"
245 249 provided_creation_steps: "A informação que você forneceu durante as etapas de criação"
246 250 visualize_processings_repository: "Selecione a caixa de modo que seja possível visualizar processamentos anteriores do seu repositório"
247   - processing_information: "Informação de processamento"
  251 + processing_information: "Informação de processamento"
248 252 time_finish_processing: "Informações sobre o tempo que cada etapa do processamento levou para concluir"
249 253 reserving_folder_repository: "PREPARAÇÃO: o sistema está reservando uma pasta para seu repositório e recuperando a configuração"
250 254 retrieving_source_code: "DOWNLOAD: recuperando o código-fonte"
... ...
features/kalibro_configuration/listing.feature
... ... @@ -9,7 +9,7 @@ Feature: Configuration listing
9 9 Then I should see "Configurations"
10 10 And I should see "Name"
11 11 And I should see "Description"
12   - And I should see "You must be logged in to create new Configurations."
  12 + And I should see "You must be logged in to create configurations."
13 13  
14 14 @kalibro_configuration_restart
15 15 Scenario: Should list the existing configurations
... ... @@ -18,7 +18,7 @@ Feature: Configuration listing
18 18 And I have a sample configuration
19 19 And I am at the All Configurations page
20 20 Then the sample configuration should be there
21   - And I should not see "You must be logged in to create new Configurations."
  21 + And I should not see "You must be logged in to create configurations."
22 22  
23 23 @kalibro_configuration_restart
24 24 Scenario: Should show the existing configuration
... ...