Tested and Ack'd but i would suggest you to write in this form[1], for sake of
readability for other people to read our code.
Cheers,
Francesco Vollero
[1]
-----
- def headers()
- result = {}
+ def set_language_header
if !ENV['LANG'].nil? && ENV['LANG'].size >= 2
- result['ACCEPT_LANGUAGE'] = ENV['LANG'][0,2]
+ {'ACCEPT_LANGUAGE' => ENV['LANG'][0,2]}
+ else
+ {}
end
- result
end
end
-----
Mon, Nov 28, 2011 at 05:59:09PM -0800, Richard Su wrote:
The cli needs to pass the language to the conductor api so that error
messages
the api returns are translated.
---
lib/aeolus_cli/model/base.rb | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/lib/aeolus_cli/model/base.rb b/lib/aeolus_cli/model/base.rb
index ae83808..0ea195c 100644
--- a/lib/aeolus_cli/model/base.rb
+++ b/lib/aeolus_cli/model/base.rb
@@ -37,6 +37,14 @@ module Aeolus
end
end
end
+
+ def headers()
+ result = {}
+ if !ENV['LANG'].nil? && ENV['LANG'].size >= 2
+ result['ACCEPT_LANGUAGE'] = ENV['LANG'][0,2]
+ end
+ result
+ end
end
# Active Resrouce Uses dashes instead of underscores, this method overrides to use
underscore
@@ -51,4 +59,4 @@ module Aeolus
end
end
end
-end
\ No newline at end of file
+end
--
1.7.6.4