Commit dd6919c521f9d5d7cc428171bc736059fa8b3481

Authored by Luciano Prestes
Committed by Daniela Feitosa
1 parent 523171af

Add locales files into noosfero plugins

- plugins: gov_user, software_communities
- Update translation on errors of create institution
- Update translation on error of create software

Signed-off-by: Gabriel Silva <gabriel93.silva@gmail.com>
Signed-off-by: Luciano Prestes Cavalcanti <lucianopcbr@gmail.com>
src/noosfero-spb/gov_user/controllers/gov_user_plugin_controller.rb
@@ -217,8 +217,8 @@ class GovUserPluginController &lt; ApplicationController @@ -217,8 +217,8 @@ class GovUserPluginController &lt; ApplicationController
217 end 217 end
218 218
219 def save_institution institution 219 def save_institution institution
220 - inst_errors = institution.errors.messages  
221 - com_errors = institution.community.errors.messages 220 + inst_errors = institution.errors.full_messages
  221 + com_errors = institution.community.errors.full_messages
222 222
223 set_errors institution 223 set_errors institution
224 224
@@ -230,7 +230,7 @@ class GovUserPluginController &lt; ApplicationController @@ -230,7 +230,7 @@ class GovUserPluginController &lt; ApplicationController
230 else 230 else
231 { :success => false, 231 { :success => false,
232 :message => _("Institution could not be created!"), 232 :message => _("Institution could not be created!"),
233 - :errors => inst_errors.merge(com_errors) 233 + :errors => inst_errors + com_errors
234 } 234 }
235 end 235 end
236 end 236 end
src/noosfero-spb/gov_user/locales/pt-BR.yml 0 → 120000
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +../../software_communities/locales/pt-BR.yml
0 \ No newline at end of file 2 \ No newline at end of file
src/noosfero-spb/gov_user/public/views/create-institution.js
@@ -113,12 +113,8 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;] @@ -113,12 +113,8 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
113 var errors = "<ul>"; 113 var errors = "<ul>";
114 var field_name; 114 var field_name;
115 115
116 - for(var error_key in response.errors) {  
117 - field_name = adjust_error_key(error_key);  
118 -  
119 - if(response.errors[error_key].length > 0){  
120 - errors += "<li><b>"+field_name+"</b>: "+response.errors[error_key]+"</li>";  
121 - } 116 + for(var error in response.errors) {
  117 + errors += "<li>"+response.errors[error]+"</li>";
122 } 118 }
123 119
124 errors += "</ul>"; 120 errors += "</ul>";
@@ -147,14 +143,6 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;] @@ -147,14 +143,6 @@ modulejs.define(&#39;CreateInstitution&#39;, [&#39;jquery&#39;, &#39;NoosferoRoot&#39;, &#39;SelectElement&#39;]
147 } 143 }
148 144
149 145
150 - function adjust_error_key(error_key) {  
151 - var text = error_key.replace(/_/, " ");  
152 - text = text.charAt(0).toUpperCase() + text.slice(1);  
153 -  
154 - return text;  
155 - }  
156 -  
157 -  
158 function save_institution(evt) { 146 function save_institution(evt) {
159 evt.preventDefault(); 147 evt.preventDefault();
160 148
src/noosfero-spb/software_communities/locales/pt-BR.yml 0 → 100644
@@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
  1 +# encoding: UTF-8
  2 +
  3 +"pt-BR": &pt-BR
  4 +
  5 + activerecord:
  6 + attributes:
  7 + community:
  8 + name: 'Nome'
  9 + state: 'Estado'
  10 + city: 'Cidade'
  11 + software_info:
  12 + finality: 'Finalidade'
  13 + license_info:
  14 + version: 'Versão'
  15 + institution:
  16 + name: 'Nome'
  17 + state: 'Estado'
  18 + city: 'Cidade'
  19 + governmental_power: 'Poder Governamental'
  20 + governmental_sphere: 'Esfera Governamental'
  21 + juridical_nature: 'Natureza Jurídica'
  22 +
  23 +'pt_BR':
  24 + <<: *pt-BR
  25 +'pt':
  26 + <<: *pt-BR
src/noosfero-spb/software_communities/po/pt/software_communities.po
@@ -860,8 +860,8 @@ msgstr &quot;&quot; @@ -860,8 +860,8 @@ msgstr &quot;&quot;
860 "e critérios" 860 "e critérios"
861 861
862 #: plugins/software_communities/views/software_communities_plugin_myprofile/new_software.html.erb:22 862 #: plugins/software_communities/views/software_communities_plugin_myprofile/new_software.html.erb:22
863 -msgid "\"Can`t create new software: #{@errors.length} errors\""  
864 -msgstr "\"Não foi possível criar o software: #{@errors.length} errors\"" 863 +msgid "Can`t create new software: %s errors"
  864 +msgstr "Não foi possível criar o software: %s erros"
865 865
866 #: plugins/software_communities/views/software_communities_plugin_myprofile/new_software.html.erb:45 866 #: plugins/software_communities/views/software_communities_plugin_myprofile/new_software.html.erb:45
867 msgid "Domain" 867 msgid "Domain"
src/noosfero-spb/software_communities/po/software_communities.pot
@@ -825,7 +825,7 @@ msgid &quot;&quot; @@ -825,7 +825,7 @@ msgid &quot;&quot;
825 msgstr "" 825 msgstr ""
826 826
827 #: plugins/software_communities/views/software_communities_plugin_myprofile/new_software.html.erb:22 827 #: plugins/software_communities/views/software_communities_plugin_myprofile/new_software.html.erb:22
828 -msgid "\"Can`t create new software: #{@errors.length} errors\"" 828 +msgid "Can`t create new software: %s errors"
829 msgstr "" 829 msgstr ""
830 830
831 #: plugins/software_communities/views/software_communities_plugin_myprofile/new_software.html.erb:45 831 #: plugins/software_communities/views/software_communities_plugin_myprofile/new_software.html.erb:45
src/noosfero-spb/software_communities/views/software_communities_plugin_myprofile/new_software.html.erb
@@ -19,7 +19,7 @@ @@ -19,7 +19,7 @@
19 19
20 <% unless @errors.blank? %> 20 <% unless @errors.blank? %>
21 <div class="errorExplanation" id="errorExplanation"> 21 <div class="errorExplanation" id="errorExplanation">
22 - <h2> <%= _("Can`t create new software: #{@errors.length} errors") %> </h2> 22 + <h2> <%= _("Can`t create new software: %s errors") % @errors.length %> </h2>
23 <ul> 23 <ul>
24 <% @errors.each do |error| %> 24 <% @errors.each do |error| %>
25 <li> <%= error %> </li> 25 <li> <%= error %> </li>