Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* localize.

  • Loading branch information...
commit a2172adadc1da030e6bdcb5c5c3b9b9aa9961d27 1 parent fbbc5f5
@kou authored
View
4 app/controllers/contents_controller.rb
@@ -54,7 +54,7 @@ def create
respond_to do |format|
if @content.save
- flash[:notice] = 'Content was successfully created.'
+ flash[:notice] = t('Content was successfully created.')
format.html { redirect_to(@content) }
format.xml { render :xml => @content, :status => :created, :location => @content }
else
@@ -71,7 +71,7 @@ def update
respond_to do |format|
if @content.update_attributes(params[:content])
- flash[:notice] = 'Content was successfully updated.'
+ flash[:notice] = t('Content was successfully updated.')
format.html { redirect_to(@content) }
format.xml { head :ok }
else
View
2  app/controllers/images_controller.rb
@@ -42,7 +42,7 @@ def create
respond_to do |format|
if @image.save
- flash[:notice] = 'Image was successfully created.'
+ flash[:notice] = t('Image was successfully uploaded.')
format.html { redirect_to(formatted_image_path(@image, :html)) }
format.xml { render :xml => @image, :status => :created, :location => @image }
else
View
2  config/locales/ja.yml
@@ -47,6 +47,8 @@ ja:
"(example: /my-site)": "(例: /my-site)"
"Site was successfully updated.": "サイトの更新に成功しました。"
+ "Content was successfully updated.": "コンテンツの更新に成功しました。"
+ "Image was successfully uploaded.": "画像のアップロードに成功しました。"
"Image list": "画像一覧"
"Image file": "画像ファイル"
View
22 lib/ascii_value_validator.rb
@@ -0,0 +1,22 @@
+module AsciiValueValidator
+ def validate_ascii_value(key, value, options={})
+ case value
+ when /\s/
+ errors.add(key, :have_space, :value => value)
+ when /[?:;'"!@\#$%^&*()+=|~`\[\]{}\\]/
+ errors.add(key, :have_symbol, :value => value)
+ else
+ if /\// =~ value and !options[:accept_slash]
+ errors.add(key, :have_symbol, :value => value)
+ elsif /-/ =~ value and !options[:accept_hyphen]
+ errors.add(key, :have_symbol, :value => value)
+ elsif /_/ =~ value and !options[:accept_underscore]
+ errors.add(key, :have_symbol, :value => value)
+ elsif /\A[^a-zA-Z0-9]+\z/ =~ value
+ errors.add(key, :have_japanese, :value => value)
+ elsif !options[:default_is_valid]
+ errors.add(key, :invalid, :value => value)
+ end
+ end
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.