Commit a785354a226708b322f06e7491b386b406ec6d94

Authored by Rafael Martins
1 parent ce0d2f92

Localization for the shopping cart

plugins/shopping_cart/controllers/shopping_cart_plugin_profile_controller.rb
... ... @@ -118,7 +118,7 @@ class ShoppingCartPluginProfileController < ProfileController
118 118 session[:cart][:visibility] = true
119 119 render :text => {
120 120 :ok => true,
121   - :message => _('Cart displayed.'),
  121 + :message => _('Basket displayed.'),
122 122 :error => {:code => 0}
123 123 }.to_json
124 124 rescue Exception => exception
... ... @@ -137,7 +137,7 @@ class ShoppingCartPluginProfileController < ProfileController
137 137 session[:cart][:visibility] = false
138 138 render :text => {
139 139 :ok => true,
140   - :message => _('Cart Hidden.'),
  140 + :message => _('Basket hidden.'),
141 141 :error => {:code => 0}
142 142 }.to_json
143 143 rescue Exception => exception
... ... @@ -173,7 +173,7 @@ class ShoppingCartPluginProfileController < ProfileController
173 173 :ok => false,
174 174 :error => {
175 175 :code => 2,
176   - :message => _("There is no cart.")
  176 + :message => _("There is no basket.")
177 177 }
178 178 }.to_json
179 179 return false
... ... @@ -203,7 +203,7 @@ class ShoppingCartPluginProfileController < ProfileController
203 203 :ok => false,
204 204 :error => {
205 205 :code => 4,
206   - :message => _("The cart doesn't have this product.")
  206 + :message => _("The basket doesn't have this product.")
207 207 }
208 208 }.to_json
209 209 return false
... ...
plugins/shopping_cart/lib/shopping_cart_plugin.rb
... ... @@ -4,17 +4,17 @@ require_dependency 'ext/person'
4 4 class ShoppingCartPlugin < Noosfero::Plugin
5 5  
6 6 def self.plugin_name
7   - "Shopping Cart"
  7 + "Shopping Basket"
8 8 end
9 9  
10 10 def self.plugin_description
11   - _("A shopping cart feature for enterprises")
  11 + _("A shopping basket feature for enterprises")
12 12 end
13 13  
14 14 def add_to_cart_button(item, enterprise = context.profile)
15 15 if enterprise.shopping_cart && item.available
16 16 lambda {
17   - link_to(_('Add to cart'), "add:#{item.name}",
  17 + link_to(_('Add to basket'), "add:#{item.name}",
18 18 :class => 'cart-add-item',
19 19 :onclick => "Cart.addItem('#{enterprise.identifier}', #{item.id}, this); return false"
20 20 )
... ... @@ -40,10 +40,10 @@ class ShoppingCartPlugin &lt; Noosfero::Plugin
40 40 def control_panel_buttons
41 41 buttons = []
42 42 if context.profile.enterprise?
43   - buttons << { :title => 'Shopping cart', :icon => 'shopping_cart_icon', :url => {:controller => 'shopping_cart_plugin_myprofile', :action => 'edit'} }
  43 + buttons << { :title => _('Shopping basket'), :icon => 'shopping-cart-icon', :url => {:controller => 'shopping_cart_plugin_myprofile', :action => 'edit'} }
44 44 end
45 45 if context.profile.enterprise? && context.profile.shopping_cart
46   - buttons << { :title => 'Purchase reports', :icon => 'shopping-cart-purchase-report', :url => {:controller => 'shopping_cart_plugin_myprofile', :action => 'reports'} }
  46 + buttons << { :title => _('Purchase reports'), :icon => 'shopping-cart-purchase-report', :url => {:controller => 'shopping_cart_plugin_myprofile', :action => 'reports'} }
47 47 end
48 48  
49 49 buttons
... ...
plugins/shopping_cart/public/style.css
1 1 @import url(colorbox/colorbox.css);
2 2  
3   -.cart-add-item {
4   - position: absolute;
5   - right: 5px;
6   - top: 5px;
  3 +.cart-add-item .ui-icon-cart {
  4 + background: url("images/button-icon.png") no-repeat scroll left center transparent;
  5 + width: 22px;
  6 + }
  7 + .cart-buy .ui-icon-cart {
  8 + background: url("images/button-icon.png") no-repeat scroll left center transparent;
  9 + width: 22px;
  10 + }
  11 +.cart-add-item .ui-button-text {
  12 + padding-left: 2.6em;
7 13 }
8 14  
9 15 .product-item .cart-add-item {
... ... @@ -179,8 +185,8 @@ label.error {
179 185  
180 186 .controller-profile_editor a.control-panel-shopping-cart-purchase-report {background-image: url(images/control-panel/purchase-report.png)}
181 187 .controller-profile_editor .msie6 a.control-panel-shopping-cart-purchase-report {background-image: url(images/control-panel/purchase-report.gif)}
182   -.controller-profile_editor a.control-panel-shopping-cart {background-image: url(/images/control-panel/shopping-cart.png)}
183   -.controller-profile_editor .msie6 a.control-panel-shopping-cart {background-image: url(/images/control-panel/shopping-cart.gif)}
  188 +.controller-profile_editor a.control-panel-shopping-cart-icon {background-image: url(images/control-panel/icon.png)}
  189 +.controller-profile_editor .msie6 a.control-panel-shopping-cart-icon {background-image: url(images/control-panel/icon.gif)}
184 190  
185 191 .action-shopping_cart_plugin_myprofile-reports td.order-info {
186 192 padding: 0px;
... ...
plugins/shopping_cart/views/cart.html.erb
1 1 <div id="cart1" class="cart" style="display:none"
2 2 data-l10nRemoveItem="<%=_('Are you sure you want to remove this item?')%>"
3   - data-l10nCleanCart="<%=_('Are you sure you want to clean your cart?')%>">
  3 + data-l10nCleanCart="<%=_('Are you sure you want to clean your basket?')%>">
4 4 <div class="cart-inner">
5 5 <div class="cart-content">
6   - <h3><%= _("Cart") %></h3>
7   - <a href="cart:clean" onclick="Cart.clean(this); return false" class="cart-clean"><%=_('Clean')%></a>
  6 + <h3><%= _("Basket") %></h3>
  7 + <a href="cart:clean" onclick="Cart.clean(this); return false" class="cart-clean"><%=_('Clean basket')%></a>
8 8 <ul class="cart-items"></ul>
9 9 <div class="cart-total"><%=_('Total:')%> <b></b></div>
10 10 <a href="cart:buy" class="cart-buy"><%=_('Shopping checkout')%></a>
11 11 </div>
12 12 <a href="#" onclick="Cart.toggle(this); return false" class="cart-toggle">
13   - <span class="str-show"><%=_('Show cart')%></span>
14   - <span class="str-hide" style="display:none"><%=_('Hide')%></span>
  13 + <span class="str-show"><%=_('Show basket')%></span>
  14 + <span class="str-hide" style="display:none"><%=_('Hide basket')%></span>
15 15 </a>
16 16 </div>
17 17 </div>
... ...
plugins/shopping_cart/views/shopping_cart_plugin_myprofile/edit.html.erb
1   -<h1> <%= _('Cart options') %> </h1>
  1 +<h1> <%= _('Basket options') %> </h1>
2 2  
3 3 <% form_for(:profile_attr, profile, :url => {:action => 'edit'}, :html => {:method => 'post'}) do |f| %>
4 4 <%= labelled_form_field(_('Enabled?'), f.check_box(:shopping_cart)) %>
... ...