Skip to content

Commit

Permalink
Merge pull request puppetlabs#306 from lionce/FM-7331
Browse files Browse the repository at this point in the history
(FM-7331)-i18N-ify
  • Loading branch information
david22swan authored Oct 9, 2018
2 parents 8a46c6d + 23d95ca commit 166281a
Show file tree
Hide file tree
Showing 13 changed files with 322 additions and 16 deletions.
3 changes: 3 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ fixtures:
create_multiple_ini_settings: "#{source_dir}/spec/fixtures/create_multiple_ini_settings"
inherit_ini_setting: "#{source_dir}/spec/fixtures/inherit_ini_setting"
inherit_test1: "#{source_dir}/spec/fixtures/inherit_test1"
repositories:
"translate": "https://github.com/puppetlabs/puppetlabs-translate"

12 changes: 12 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Gemfile:
ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018'
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')"
required:
':development':
- gem: puppet-lint-i18n
':system_tests':
- gem: 'puppet-module-posix-system-r#{minor_version}'
platforms: ruby
Expand All @@ -33,3 +35,13 @@ Gemfile:

.gitlab-ci.yml:
unmanaged: true

Rakefile:
requires:
- puppet_pot_generator/rake_tasks

.rubocop.yml:
require:
- rubocop-i18n
- rubocop-rspec

1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ group :development do
gem "puppet-module-posix-dev-r#{minor_version}", require: false, platforms: [:ruby]
gem "puppet-module-win-default-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-module-win-dev-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-lint-i18n", require: false
gem "net-telnet", '0.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.3.0')
gem "net-telnet", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0')
gem "github_changelog_generator", require: false, git: 'https://github.com/skywinder/github-changelog-generator', ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')
Expand Down
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-syntax/tasks/puppet-syntax'
require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any?
require 'github_changelog_generator/task' if Bundler.rubygems.find_name('github_changelog_generator').any?
require 'puppet_pot_generator/rake_tasks'

def changelog_user
return unless Rake.application.top_level_tasks.include? "changelog"
Expand Down
10 changes: 5 additions & 5 deletions lib/puppet/parser/functions/create_ini_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,26 @@ module Puppet::Parser::Functions
) do |arguments|

unless arguments.size.between?(1, 2)
raise(Puppet::ParseError, 'create_ini_settings(): Wrong number of arguments ' \
"given (#{arguments.size} for 1 or 2)")
raise(Puppet::ParseError, _('create_ini_settings(): Wrong number of arguments ' \
'given (%{arguments_size} for 1 or 2)') % { arguments_size: arguments.size })
end

settings = arguments[0]
defaults = arguments[1] || {}

if [settings, defaults].any? { |i| !i.is_a?(Hash) }
raise(Puppet::ParseError,
'create_ini_settings(): Requires all arguments to be a Hash')
_('create_ini_settings(): Requires all arguments to be a Hash'))
end

resources = settings.keys.each_with_object({}) do |section, res|
unless settings[section].is_a?(Hash)
raise(Puppet::ParseError,
"create_ini_settings(): Section #{section} must contain a Hash")
_('create_ini_settings(): Section %{section} must contain a Hash') % { section: section })
end

path = defaults.merge(settings)['path']
raise Puppet::ParseError, 'create_ini_settings(): must pass the path parameter to the Ini_setting resource!' unless path
raise Puppet::ParseError, _('create_ini_settings(): must pass the path parameter to the Ini_setting resource!') unless path

settings[section].each do |setting, value|
res["#{path} [#{section}] #{setting}"] = {
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/ini_setting/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def self.instances
# declaration). This allows 'purging' to be used to clear out
# all settings from a particular ini file except those included in
# the catalog.
raise(Puppet::Error, 'Ini_settings only support collecting instances when a file path is hard coded') unless respond_to?(:file_path)
raise(Puppet::Error, _('Ini_settings only support collecting instances when a file path is hard coded')) unless respond_to?(:file_path)

# figure out what to do about the separator
ini_file = Puppet::Util::IniFile.new(file_path, '=')
Expand Down
5 changes: 2 additions & 3 deletions lib/puppet/type/ini_setting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ def munge_boolean_md5(value)
when :md5, 'md5'
:md5
else
raise('expected a boolean value or :md5')
raise(_('expected a boolean value or :md5'))
end
end

newparam(:name, namevar: true) do
desc 'An arbitrary name used as the identity of the resource.'
end
Expand Down Expand Up @@ -49,7 +48,7 @@ def munge_boolean_md5(value)
desc 'The ini file Puppet will ensure contains the specified setting.'
validate do |value|
unless Puppet::Util.absolute_path?(value)
raise(Puppet::Error, "File paths must be fully qualified, not '#{value}'")
raise(Puppet::Error, _("File paths must be fully qualified, not '%{value}'") % { value: value })
end
end
end
Expand Down
8 changes: 3 additions & 5 deletions lib/puppet/type/ini_subsetting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ def munge_boolean_md5(value)
when :md5, 'md5'
:md5
else
raise('expected a boolean value or :md5')
raise(_('expected a boolean value or :md5'))
end
end

newparam(:name, namevar: true) do
desc 'An arbitrary name used as the identity of the resource.'
end
Expand Down Expand Up @@ -51,11 +50,10 @@ def munge_boolean_md5(value)
desc 'The ini file Puppet will ensure contains the specified setting.'
validate do |value|
unless (Puppet.features.posix? && value =~ %r{^\/}) || (Puppet.features.microsoft_windows? && (value =~ %r{^.:\/} || value =~ %r{^\/\/[^\/]+\/[^\/]+}))
raise(Puppet::Error, "File paths must be fully qualified, not '#{value}'")
raise(Puppet::Error, _("File paths must be fully qualified, not '%{value}'") % { value: value })
end
end
end

newparam(:show_diff) do
desc 'Whether to display differences when the setting changes.'
defaultto :true
Expand All @@ -80,7 +78,7 @@ def munge_boolean_md5(value)

validate do |value|
unless value =~ %r{^["']?$}
raise Puppet::Error, %q(:quote_char valid values are '', '"' and "'")
raise Puppet::Error, _(%q(:quote_char valid values are '', '"' and "'"))
end
end
end
Expand Down
76 changes: 76 additions & 0 deletions locales/ja/puppetlabs-inifile.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# #-#-#-#-# puppetlabs-inifile.pot (puppetlabs-inifile 2.4.0-7-g89be913) #-#-#-#-#
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2018 Puppet, Inc.
# This file is distributed under the same license as the puppetlabs-inifile package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2018.
#
#, fuzzy
msgid ""
msgstr ""
"#-#-#-#-# puppetlabs-inifile.pot (puppetlabs-inifile 2.4.0-7-g89be913) #-#-"
"#-#-#\n"
"Project-Id-Version: puppetlabs-inifile 2.4.0-7-g89be913\n"
"\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2018-10-02 16:38+0300\n"
"PO-Revision-Date: 2018-10-02 16:38+0300\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"#-#-#-#-# puppet.pot (PACKAGE VERSION) #-#-#-#-#\n"
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-02 16:39:00 +0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Translate Toolkit 2.0.0\n"

#: ../lib/puppet/parser/functions/create_ini_settings.rb:51
msgid ""
"create_ini_settings(): Wrong number of arguments given (%{arguments_size} "
"for 1 or 2)"
msgstr ""
"ƈřḗȧŧḗ_īƞī_şḗŧŧīƞɠş(): Ẇřǿƞɠ ƞŭḿƀḗř ǿƒ ȧřɠŭḿḗƞŧş ɠīṽḗƞ (%{arguments_size} "
"ƒǿř 1 ǿř 2)"

#: ../lib/puppet/parser/functions/create_ini_settings.rb:60
msgid "create_ini_settings(): Requires all arguments to be a Hash"
msgstr "ƈřḗȧŧḗ_īƞī_şḗŧŧīƞɠş(): Řḗɋŭīřḗş ȧŀŀ ȧřɠŭḿḗƞŧş ŧǿ ƀḗ ȧ Ħȧşħ"

#: ../lib/puppet/parser/functions/create_ini_settings.rb:66
msgid "create_ini_settings(): Section %{section} must contain a Hash"
msgstr "ƈřḗȧŧḗ_īƞī_şḗŧŧīƞɠş(): Şḗƈŧīǿƞ %{section} ḿŭşŧ ƈǿƞŧȧīƞ ȧ Ħȧşħ"

#: ../lib/puppet/parser/functions/create_ini_settings.rb:70
msgid ""
"create_ini_settings(): must pass the path parameter to the Ini_setting "
"resource!"
msgstr ""
"ƈřḗȧŧḗ_īƞī_şḗŧŧīƞɠş(): ḿŭşŧ ƥȧşş ŧħḗ ƥȧŧħ ƥȧřȧḿḗŧḗř ŧǿ ŧħḗ Īƞī_şḗŧŧīƞɠ "
"řḗşǿŭřƈḗ!"

#: ../lib/puppet/provider/ini_setting/ruby.rb:14
msgid ""
"Ini_settings only support collecting instances when a file path is hard coded"
msgstr ""
"Īƞī_şḗŧŧīƞɠş ǿƞŀẏ şŭƥƥǿřŧ ƈǿŀŀḗƈŧīƞɠ īƞşŧȧƞƈḗş ẇħḗƞ ȧ ƒīŀḗ ƥȧŧħ īş ħȧřḓ ƈǿḓḗḓ"

#: ../lib/puppet/type/ini_setting.rb:19 ../lib/puppet/type/ini_subsetting.rb:18
msgid "expected a boolean value or :md5"
msgstr "ḗẋƥḗƈŧḗḓ ȧ ƀǿǿŀḗȧƞ ṽȧŀŭḗ ǿř :ḿḓ5"

#: ../lib/puppet/type/ini_setting.rb:51 ../lib/puppet/type/ini_subsetting.rb:54
msgid "File paths must be fully qualified, not '%{value}'"
msgstr "Ƒīŀḗ ƥȧŧħş ḿŭşŧ ƀḗ ƒŭŀŀẏ ɋŭȧŀīƒīḗḓ, ƞǿŧ '%{value}'"

#: ../lib/puppet/type/ini_subsetting.rb:82
msgid ":quote_char valid values are '', '\"' and \"'\""
msgstr ":ɋŭǿŧḗ_ƈħȧř ṽȧŀīḓ ṽȧŀŭḗş ȧřḗ '', '\"' ȧƞḓ \"'\""
130 changes: 130 additions & 0 deletions locales/puppetlabs-inifile.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# #-#-#-#-# puppetlabs-inifile_metadata.pot (PACKAGE VERSION) #-#-#-#-#
#
# #-#-#-#-# puppetlabs-inifile.pot (PACKAGE VERSION) #-#-#-#-#
# #-#-#-#-# puppetlabs-inifile_metadata.pot (PACKAGE VERSION) #-#-#-#-#
#
# #-#-#-#-# puppetlabs-inifile.pot (PACKAGE VERSION) #-#-#-#-#
# #-#-#-#-# puppetlabs-inifile_metadata.pot (PACKAGE VERSION) #-#-#-#-#
#
# #-#-#-#-# puppetlabs-inifile.pot (puppetlabs-inifile 2.4.0-8-g7eb3c35) #-#-#-#-#
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2018 Puppet, Inc.
# This file is distributed under the same license as the puppetlabs-inifile package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2018.
#
#, fuzzy
msgid ""
msgstr ""
"#-#-#-#-# puppetlabs-inifile_metadata.pot (PACKAGE VERSION) #-#-#-#-#\n"
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To:\n"
"POT-Creation-Date: 2018-10-09T11:54:29+03:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Translate Toolkit 2.0.0\n"
"#-#-#-#-# puppetlabs-inifile.pot (PACKAGE VERSION) #-#-#-#-#\n"
"#-#-#-#-# puppetlabs-inifile_metadata.pot (PACKAGE VERSION) #-#-#-#-#\n"
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To:\n"
"POT-Creation-Date: 2018-10-09T11:45:05+03:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Translate Toolkit 2.0.0\n"
"#-#-#-#-# puppetlabs-inifile.pot (PACKAGE VERSION) #-#-#-#-#\n"
"#-#-#-#-# puppetlabs-inifile_metadata.pot (PACKAGE VERSION) #-#-#-#-#\n"
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To:\n"
"POT-Creation-Date: 2018-10-02T17:35:37+03:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Translate Toolkit 2.0.0\n"
"#-#-#-#-# puppetlabs-inifile.pot (puppetlabs-inifile 2.4.0-8-g7eb3c35) #-#-"
"#-#-#\n"
"Project-Id-Version: puppetlabs-inifile 2.4.0-8-g7eb3c35\n"
"\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2018-10-02 17:35+0300\n"
"PO-Revision-Date: 2018-10-02 17:35+0300\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"#-#-#-#-# puppet.pot (PACKAGE VERSION) #-#-#-#-#\n"
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-02 17:35:29 +0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Translate Toolkit 2.0.0\n"
"#-#-#-#-# puppet.pot (PACKAGE VERSION) #-#-#-#-#\n"
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-09 11:53:52 +0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Translate Toolkit 2.0.0\n"

#. metadata.json
#: .summary
msgid "Resource types for managing settings in INI files"
msgstr ""

#: ../lib/puppet/parser/functions/create_ini_settings.rb:51
msgid ""
"create_ini_settings(): Wrong number of arguments given (%{arguments_size} "
"for 1 or 2)"
msgstr ""

#: ../lib/puppet/parser/functions/create_ini_settings.rb:60
msgid "create_ini_settings(): Requires all arguments to be a Hash"
msgstr ""

#: ../lib/puppet/parser/functions/create_ini_settings.rb:66
msgid "create_ini_settings(): Section %{section} must contain a Hash"
msgstr ""

#: ../lib/puppet/parser/functions/create_ini_settings.rb:70
msgid ""
"create_ini_settings(): must pass the path parameter to the Ini_setting "
"resource!"
msgstr ""

#: ../lib/puppet/provider/ini_setting/ruby.rb:14
msgid ""
"Ini_settings only support collecting instances when a file path is hard coded"
msgstr ""

#: ../lib/puppet/type/ini_setting.rb:19 ../lib/puppet/type/ini_subsetting.rb:18
msgid "expected a boolean value or :md5"
msgstr ""

#: ../lib/puppet/type/ini_setting.rb:51 ../lib/puppet/type/ini_subsetting.rb:54
msgid "File paths must be fully qualified, not '%{value}'"
msgstr ""

#: ../lib/puppet/type/ini_subsetting.rb:82
msgid ":quote_char valid values are '', '\"' and \"'\""
msgstr ""
7 changes: 5 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
"project_page": "https://github.com/puppetlabs/puppetlabs-inifile",
"issues_url": "https://tickets.puppetlabs.com/browse/MODULES",
"dependencies": [

{
"name": "puppetlabs/translate",
"version_requirement": ">= 1.0.0 < 2.0.0"
}
],
"operatingsystem_support": [
{
Expand Down Expand Up @@ -95,6 +98,6 @@
}
],
"template-url": "https://github.com/puppetlabs/pdk-templates",
"template-ref": "heads/master-0-gb4e2f83",
"template-ref": "heads/master-0-g810b982",
"pdk-version": "1.7.0"
}
Loading

0 comments on commit 166281a

Please sign in to comment.