Commit 6519a11717920c086dd025fd972925dbd899c3a1
Committed by
Rafael Manzo
1 parent
8c810237
Exists in
colab
and in
4 other branches
WIP Internationalizing of project views
Signed off by: Daniel Miranda <danielkza2@gmail.com>
Showing
8 changed files
with
38 additions
and
29 deletions
Show diff stats
app/views/projects/_form.html.erb
| ... | ... | @@ -16,14 +16,14 @@ |
| 16 | 16 | </div> |
| 17 | 17 | <div class="form-row"> |
| 18 | 18 | <div class="field-container"> |
| 19 | - <%= f.label "Image url", class: 'control-label' %><br> | |
| 19 | + <%= f.label t("image_url"), class: 'control-label' %><br> | |
| 20 | 20 | <%= f.text_field :image_url, class: 'text-area', value: @project.attributes.nil? || @project.attributes.image_url.nil? ? '#' : @project.attributes.image_url %> |
| 21 | 21 | </div> |
| 22 | 22 | </div> |
| 23 | 23 | </div> |
| 24 | 24 | </div> |
| 25 | 25 | <div class="row margin-left-none" style="margin-top: 20px"> |
| 26 | - <%= f.submit 'Save', class: 'btn btn-primary' %> | |
| 27 | - <%= link_to 'All Projects', projects_path, class: 'btn btn-default'%> | |
| 26 | + <%= f.submit t('save'), class: 'btn btn-primary' %> | |
| 27 | + <%= link_to t('all_projects'), projects_path, class: 'btn btn-default'%> | |
| 28 | 28 | </div> |
| 29 | 29 | <% end %> | ... | ... |
app/views/projects/edit.html.erb
app/views/projects/index.html.erb
| 1 | 1 | <div class="page-header"> |
| 2 | - <h1>Projects</h1> | |
| 2 | + <h1><%= t("projects") %></h1> | |
| 3 | 3 | </div> |
| 4 | 4 | |
| 5 | 5 | <% if user_signed_in? %> |
| 6 | 6 | <p> |
| 7 | - <%= link_to 'New Project', new_project_path, class: 'btn btn-primary' %> | |
| 7 | + <%= link_to t('new_project'), new_project_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">×</button> |
| 12 | - You must be logged in to create new Projects. | |
| 12 | + <%= t('must_logged_create_projects') %> | |
| 13 | 13 | </p> |
| 14 | 14 | <% end %> |
| 15 | 15 | |
| 16 | -<%= render partial: 'shared/project_list', locals: {projects: @projects} %> | |
| 17 | 16 | \ No newline at end of file |
| 17 | +<%= render partial: 'shared/project_list', locals: {projects: @projects} %> | ... | ... |
app/views/projects/new.html.erb
app/views/projects/show.html.erb
| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | <%= image_tag "#{@project_image.url}", size:"128x128" %> |
| 7 | 7 | <% else %> |
| 8 | 8 | <center><i class="fa fa-file-image-o fa-5x"></i></center><br /> |
| 9 | - No image available | |
| 9 | + <%= t("no_image_available") %> | |
| 10 | 10 | <% end %> |
| 11 | 11 | </div> |
| 12 | 12 | <div class="col-md-10"> |
| ... | ... | @@ -16,22 +16,22 @@ |
| 16 | 16 | </div> |
| 17 | 17 | |
| 18 | 18 | <p> |
| 19 | - <strong>Description:</strong> | |
| 19 | + <strong> <%= t("description") %>:</strong> | |
| 20 | 20 | <%= @project.description %> |
| 21 | 21 | </p> |
| 22 | 22 | |
| 23 | 23 | <hr /> |
| 24 | 24 | |
| 25 | -<h2>Repositories</h2> | |
| 25 | +<h2><%= t("repositories") %></h2> | |
| 26 | 26 | |
| 27 | -<% if project_owner? @project.id %><%= link_to 'New Repository', new_project_repository_path(@project,), class: 'btn btn-primary' %><% end %> | |
| 27 | +<% if project_owner? @project.id %><%= link_to t('new_repository'), new_project_repository_path(@project,), class: 'btn btn-primary' %><% end %> | |
| 28 | 28 | |
| 29 | 29 | <table class="table table-hover"> |
| 30 | 30 | <thead> |
| 31 | 31 | <tr> |
| 32 | - <th>Name</th> | |
| 33 | - <th>Type</th> | |
| 34 | - <th>Address</th> | |
| 32 | + <th><%= t("Name") %></th> | |
| 33 | + <th><%= t("Type") %></th> | |
| 34 | + <th><%= t("Address") %></th> | |
| 35 | 35 | <th colspan="2"></th> |
| 36 | 36 | </tr> |
| 37 | 37 | </thead> |
| ... | ... | @@ -40,7 +40,7 @@ |
| 40 | 40 | <% if @project_repositories.size == 0 %> |
| 41 | 41 | <tr> |
| 42 | 42 | <% col_number = project_owner?(@project.id) ? 4 : 3 %> |
| 43 | - <td colspan="<%= col_number %>">There are no Repositories yet!</td> | |
| 43 | + <td colspan="<%= col_number %>"> <%= t("no_repositories") %></td> | |
| 44 | 44 | </tr> |
| 45 | 45 | <% end %> |
| 46 | 46 | <% @project_repositories.each do |repository| %> |
| ... | ... | @@ -50,11 +50,11 @@ |
| 50 | 50 | <td><%= repository.address %></td> |
| 51 | 51 | <td> |
| 52 | 52 | <% if project_owner? @project.id %> |
| 53 | - <%= link_to 'Edit', edit_project_repository_path(@project, repository.id), class: 'btn btn-info' %> | |
| 53 | + <%= link_to t('edit'), edit_project_repository_path(@project, repository.id), class: 'btn btn-info' %> | |
| 54 | 54 | <% end %> |
| 55 | 55 | </td> |
| 56 | 56 | <td> |
| 57 | - <%= link_to 'Show', project_repository_path(@project, repository.id), class: 'btn btn-info' %></td> | |
| 57 | + <%= link_to t('show'), project_repository_path(@project, repository.id), class: 'btn btn-info' %></td> | |
| 58 | 58 | </td> |
| 59 | 59 | </tr> |
| 60 | 60 | <% end %> |
| ... | ... | @@ -65,6 +65,6 @@ |
| 65 | 65 | |
| 66 | 66 | <p> |
| 67 | 67 | <% if project_owner? @project.id %> |
| 68 | - <%= link_to 'Destroy Project', project_path(@project.id), method: :delete, data: { confirm: 'Are you sure that you want to destroy this Project?' }, class: 'btn btn-danger' %> | |
| 68 | + <%= link_to t('destroy_project'), project_path(@project.id), method: :delete, data: { confirm: t('want_destroy_project') }, class: 'btn btn-danger' %> | |
| 69 | 69 | <% end %> |
| 70 | 70 | </p> | ... | ... |
config/locales/views/en.yml
| ... | ... | @@ -39,8 +39,6 @@ en: |
| 39 | 39 | code: "Code" |
| 40 | 40 | reading_group: "Reading Group" |
| 41 | 41 | reading_groups: "Reading Groups" |
| 42 | - project: "Project" | |
| 43 | - projects: "Projects" | |
| 44 | 42 | configuration: "Configuration" |
| 45 | 43 | configurations: "Configurations" |
| 46 | 44 | edit_account: "Edit Account" |
| ... | ... | @@ -51,7 +49,6 @@ en: |
| 51 | 49 | ranges: "Ranges" |
| 52 | 50 | range: "Range" |
| 53 | 51 | language: "Language:" |
| 54 | - new_project: "New Project" | |
| 55 | 52 | no_description: "There is no description available." |
| 56 | 53 | welcome: "Welcome" |
| 57 | 54 | metrics: "Metrics" |
| ... | ... | @@ -177,8 +174,6 @@ en: |
| 177 | 174 | new_range: "New Range" |
| 178 | 175 | new_reading: "New Reading" |
| 179 | 176 | only_point_printed_chart: "There is only one point and it will not be printed into a chart." |
| 180 | - edit_project: "Edit Project" | |
| 181 | - must_logged_create_projetcs: "You must be logged in to create new Projects." | |
| 182 | 177 | there_readings_yet: "There are no Readings yet!" |
| 183 | 178 | edit_reading_group: "Edit Reading Group" |
| 184 | 179 | must_logged_create_reading_groups: "You must be logged in to create new Reading Groups." |
| ... | ... | @@ -194,16 +189,12 @@ en: |
| 194 | 189 | really_want_cancel_account: "Do you really want to cancel your account?" |
| 195 | 190 | received_confirmation_instructions: "Have you received confirmation instructions?" |
| 196 | 191 | received_unlock_instructions: "Have you received unlock instructions?" |
| 197 | - your_projects: "Your projects" | |
| 198 | 192 | mezuro_team: "The Mezuro Team" |
| 199 | 193 | want_destroy_range: "Are you sure that you want to destroy this Range?" |
| 200 | 194 | compound_metric: "Compound Metric" |
| 201 | 195 | add_metric: "Add Metric" |
| 202 | 196 | destroy_configuration: "Destroy Configuration" |
| 203 | 197 | want_destroy_configuration: "Are you sure that you want to destroy this Configuration?" |
| 204 | - new_project: "New Project" | |
| 205 | - destroy_projects: "Destroy Project" | |
| 206 | - want_destroy_project: "Are you sure that you want to destroy this Project?" | |
| 207 | 198 | want_destroy_reading: "Are you sure that you want to destroy this Reading?" |
| 208 | 199 | grade_show: "Grade" |
| 209 | 200 | destroy_reading_group: "Destroy Reading Group" | ... | ... |
| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | +en: | |
| 2 | + activemodel: | |
| 3 | + models: | |
| 4 | + project: "Project" | |
| 5 | + attributes: | |
| 6 | + name: "Name" | |
| 7 | + description: "Description" | |
| 8 | + project: "Project" | |
| 9 | + projects: "Projects" | |
| 10 | + new_project: "New Project" | |
| 11 | + must_logged_create_projects: "You must be logged in to create new Projects." | |
| 12 | + edit_project: "Edit Project" | |
| 13 | + your_projects: "Your projects" | |
| 14 | + new_project: "New Project" | |
| 15 | + destroy_project: "Destroy Project" | |
| 16 | + want_destroy_project: "Are you sure that you want to destroy this Project?" | |
| 17 | + image_url: "Image URL" | |
| 18 | + all_projects: "All Projects" | ... | ... |