Skip to content

Commit

Permalink
Setup translation infrastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
ofedoren authored and stejskalleos committed Jul 13, 2023
1 parent 183908f commit 498e631
Show file tree
Hide file tree
Showing 10 changed files with 178 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ Gemfile.local
Gemfile.local.rb
pkg
.bundle

# Locale files
locale/*/*.edit.po
locale/*/*.po.time_stamp
9 changes: 9 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[main]
host = https://app.transifex.com

[o:foreman:p:foreman:r:hammer-cli-foreman-leapp]
file_filter = locale/<lang>/hammer-cli-foreman-leapp.edit.po
source_file = locale/hammer-cli-foreman-leapp.pot
source_lang = en
type = PO
resource_name = hammer-cli-foreman-leapp
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
source 'https://rubygems.org'

gemspec

gem 'gettext', '>= 3.1.3', '< 4.0.0'
5 changes: 5 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ require 'rake/testtask'
require 'bundler/gem_tasks'

Bundler::GemHelper.install_tasks

require "hammer_cli_foreman_leapp/version"
require "hammer_cli_foreman_leapp/i18n"
require "hammer_cli/i18n/find_task"
HammerCLI::I18n::FindTask.define(HammerCLIForemanLeapp::I18n::LocaleDomain.new, HammerCLIForemanLeapp.version.to_s)
2 changes: 1 addition & 1 deletion hammer_cli_foreman_leapp.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
spec.platform = Gem::Platform::RUBY
spec.summary = 'Foreman Leapp plugin for Hammer CLI'

spec.files = Dir['{lib,config}/**/*', 'LICENSE', 'README*']
spec.files = Dir['{lib,config}/**/*', 'LICENSE', 'README*'] + Dir["locale/**/*.{po,pot,mo}"]
spec.require_paths = ['lib']
spec.test_files = Dir['{test}/**/*']

Expand Down
1 change: 1 addition & 0 deletions lib/hammer_cli_foreman_leapp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require 'hammer_cli_foreman'

require 'hammer_cli_foreman_leapp/version'
require 'hammer_cli_foreman_admin/i18n'
require 'hammer_cli_foreman_leapp/preupgrade_reports'

module HammerCLIForemanLeapp
Expand Down
28 changes: 28 additions & 0 deletions lib/hammer_cli_foreman_leapp/i18n.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
require 'hammer_cli/i18n'

module HammerCLIForemanLeapp
module I18n
class LocaleDomain < HammerCLI::I18n::LocaleDomain
def translated_files
Dir.glob(File.join(File.dirname(__FILE__), '../**/*.rb'))
end

def locale_dir
File.join(File.dirname(__FILE__), '../../locale')
end

def domain_name
'hammer-cli-foreman-leapp'
end
end

class SystemLocaleDomain < LocaleDomain
def locale_dir
'/usr/share/locale'
end
end
end
end

domain = [HammerCLIForemanLeapp::I18n::LocaleDomain.new, HammerCLIForemanLeapp::I18n::SystemLocaleDomain.new].find { |d| d.available? }
HammerCLI::I18n.add_domain(domain) if domain
6 changes: 6 additions & 0 deletions locale/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#
# Makefile for PO merging and MO generation. More info in the README.
#
# Run make help to list available targets
#
include $(shell bundle exec ruby -e 'require "hammer_cli"; puts HammerCLI::I18n.main_makefile')
54 changes: 54 additions & 0 deletions locale/en/hammer-cli-foreman-leapp.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# English translations for hammer-cli-foreman-leapp package.
# Copyright (C) 2023 THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the hammer-cli-foreman-leapp package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2023.
#
msgid ""
msgstr ""
"Project-Id-Version: hammer-cli-foreman-leapp 0.1.1\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-07-12 15:43+0000\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: English\n"
"Language: en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=; plural=;\n"
"\n"

msgid "Id"
msgstr ""

msgid "Reported at"
msgstr ""

msgid "Job Invocation Id"
msgstr ""

msgid "Host Id"
msgstr ""

msgid "Entries"
msgstr ""

msgid "Host name"
msgstr ""

msgid "Title"
msgstr ""

msgid "Actor"
msgstr ""

msgid "Audience"
msgstr ""

msgid "Severity"
msgstr ""

msgid "Tags"
msgstr ""

msgid "Summary"
msgstr ""
68 changes: 68 additions & 0 deletions locale/hammer-cli-foreman-leapp.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the hammer-cli-foreman-leapp package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: hammer-cli-foreman-leapp 0.1.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-12 15:43+0000\n"
"PO-Revision-Date: 2023-07-12 15:43+0000\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"

#: ../lib/hammer_cli_foreman_leapp/preupgrade_reports.rb:9
#: ../lib/hammer_cli_foreman_leapp/preupgrade_reports.rb:21
msgid "Id"
msgstr ""

#: ../lib/hammer_cli_foreman_leapp/preupgrade_reports.rb:10
msgid "Reported at"
msgstr ""

#: ../lib/hammer_cli_foreman_leapp/preupgrade_reports.rb:11
msgid "Job Invocation Id"
msgstr ""

#: ../lib/hammer_cli_foreman_leapp/preupgrade_reports.rb:12
msgid "Host Id"
msgstr ""

#: ../lib/hammer_cli_foreman_leapp/preupgrade_reports.rb:20
msgid "Entries"
msgstr ""

#: ../lib/hammer_cli_foreman_leapp/preupgrade_reports.rb:22
msgid "Host name"
msgstr ""

#: ../lib/hammer_cli_foreman_leapp/preupgrade_reports.rb:23
msgid "Title"
msgstr ""

#: ../lib/hammer_cli_foreman_leapp/preupgrade_reports.rb:24
msgid "Actor"
msgstr ""

#: ../lib/hammer_cli_foreman_leapp/preupgrade_reports.rb:25
msgid "Audience"
msgstr ""

#: ../lib/hammer_cli_foreman_leapp/preupgrade_reports.rb:26
msgid "Severity"
msgstr ""

#: ../lib/hammer_cli_foreman_leapp/preupgrade_reports.rb:27
msgid "Tags"
msgstr ""

#: ../lib/hammer_cli_foreman_leapp/preupgrade_reports.rb:28
msgid "Summary"
msgstr ""

0 comments on commit 498e631

Please sign in to comment.