Permalink
Browse files

don't allow to delete default locale translations

  • Loading branch information...
jiongye committed Jun 1, 2012
1 parent 886e86f commit eea654f295b1252e5c9b1e2325ad81496f5eeac5
@@ -42,9 +42,13 @@ def update
def destroy
locale = params[:id]
- DynamicCopy.delete_locale(locale)
- DynamicCopy.database.save
- redirect_to locales_path, :notice => "All translations for locale #{locale} has been deleted."
+
+ # should not allow to delete default locale
+ unless locale == I18n.default_locale.to_s
+ DynamicCopy.delete_locale(locale)
+ DynamicCopy.database.save
+ redirect_to locales_path, :notice => "All translations for locale #{locale} has been deleted."
+ end
end
end
@@ -18,7 +18,10 @@
%td
= DynamicCopy.locale_names[locale]
%td
- = link_to 'Delete', locale_path(:id => locale), :method => :delete, :confirm => "All translations for this locale will be deleted, Are you sure?"
+ - if locale != I18n.default_locale.to_s
+ = link_to 'Delete', locale_path(:id => locale), :method => :delete, :confirm => "All translations for this locale will be deleted, Are you sure?"
+ - else
+ default locale
%p
= link_to 'Create New Locale', new_locale_path

0 comments on commit eea654f

Please sign in to comment.