Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: add name attribute #2

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,23 @@ You can see which languages are available by
$ locale -a

On debian based systems you can set the locale by running
update-locale LANG={lang}
update-locale LANG={lang} LANGUAGE={lang}
e.g.
update-locale LANG=en_AU.utf8
update-locale LANG=en_AU.utf8 LANGUAGE=en_AU.utf8

It updates the file /etc/default/locale

LANG variable sets the locale and LANGUAGE variable sets the fallback
language in case a program does not have translations available for
the default locale. It is also used by the gettext program.

For docs see:
* https://help.ubuntu.com/community/Locale/
* https://help.ubuntu.com/community/EnvironmentVariables
* http://www.gnu.org/savannah-checkouts/gnu/gettext/manual/html_node/The-LANGUAGE-variable.html#The-LANGUAGE-variable
* http://serverfault.com/questions/455718/for-setting-locale-in-ubuntu-what-does-the-language-environment-variable-mean
* http://serverfault.com/questions/455922/in-ubuntu-what-is-the-difference-between-en-usutf8-and-en-us-when-setting-lan

On rhel based systems you can set default locale updating /etc/sysconfig/i18n
There doesn't seem to be a command line tool to update this file?!?

Expand All @@ -25,6 +36,8 @@ Attributes
==========

* `node[:locale][:lang]` -- defaults to "en_US.utf8"
* `node[:locale][:language]` -- defaults to "en_US:"
* `node[:locale][:lc_all]` -- defaults to "en_US.utf8"

Usage
=====
Expand Down
2 changes: 2 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
default[:locale][:lang] = "en_US.utf8"
default[:locale][:language] = "en_US:"
default[:locale][:lc_all] = "en_US.utf8"
1 change: 1 addition & 0 deletions metadata.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name "chef-locale"
maintainer "Heavy Water Software Inc."
maintainer_email "[email protected]"
license "Apache 2.0"
Expand Down
6 changes: 5 additions & 1 deletion recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
end

execute "Update locale" do
command "update-locale LANG=#{node[:locale][:lang]}"
command_string = "update-locale LANG=#{node[:locale][:lang]}"
command_string << " LANGUAGE=#{node[:locale][:language]}" unless node[:locale][:language].nil?
command_string << " LC_ALL=#{node[:locale][:lc_all]}" unless node[:locale][:lc_all].nil?
Chef::Log.debug("locale command is #{command_string.inspect}")
command command_string
end

end
Expand Down