Skip to content

Translated documentation #24

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

Merged
merged 18 commits into from
Feb 20, 2023
Merged
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
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PATH_add sphinx/bin/
PATH_add bin
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
_build
_build/

bin/
sphinx/
locales/*/LC_MESSAGES/*.mo
206 changes: 43 additions & 163 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -1,195 +1,75 @@
[main]
host = https://www.transifex.com

[user_documentation.locales_it_LC_MESSAGES_roles]
file_filter = locales/<lang>/roles.po
source_file = locales/it/LC_MESSAGES/roles.po
source_lang = de
type = PO

[user_documentation.locales_it_LC_MESSAGES_access_concept]
file_filter = locales/<lang>/access_concept.po
source_file = locales/it/LC_MESSAGES/access_concept.po
source_lang = de
type = PO

[user_documentation.locales_it_LC_MESSAGES_mailing_lists]
file_filter = locales/<lang>/mailing_lists.po
source_file = locales/it/LC_MESSAGES/mailing_lists.po
source_lang = de
type = PO

[user_documentation.locales_it_LC_MESSAGES_people_filter]
file_filter = locales/<lang>/people_filter.po
source_file = locales/it/LC_MESSAGES/people_filter.po
source_lang = de
type = PO

[user_documentation.locales_it_LC_MESSAGES_tags]
file_filter = locales/<lang>/tags.po
source_file = locales/it/LC_MESSAGES/tags.po
source_lang = de
type = PO

[user_documentation.locales_it_LC_MESSAGES_invoices]
file_filter = locales/<lang>/invoices.po
source_file = locales/it/LC_MESSAGES/invoices.po
source_lang = de
type = PO

[user_documentation.locales_it_LC_MESSAGES_mailing_lists_mailchimp_export]
file_filter = locales/<lang>/mailing_lists_mailchimp_export.po
source_file = locales/it/LC_MESSAGES/mailing_lists_mailchimp_export.po
source_lang = de
type = PO

[user_documentation.locales_it_LC_MESSAGES_index]
file_filter = locales/<lang>/index.po
source_file = locales/it/LC_MESSAGES/index.po
source_lang = de
type = PO

[user_documentation.locales_en_LC_MESSAGES_roles]
file_filter = locales/<lang>/roles.po
source_file = locales/en/LC_MESSAGES/roles.po
source_lang = de
type = PO

[user_documentation.locales_en_LC_MESSAGES_access_concept]
file_filter = locales/<lang>/access_concept.po
source_file = locales/en/LC_MESSAGES/access_concept.po
source_lang = de
type = PO

[user_documentation.locales_en_LC_MESSAGES_mailing_lists]
file_filter = locales/<lang>/mailing_lists.po
source_file = locales/en/LC_MESSAGES/mailing_lists.po
source_lang = de
type = PO

[user_documentation.locales_en_LC_MESSAGES_people_filter]
file_filter = locales/<lang>/people_filter.po
source_file = locales/en/LC_MESSAGES/people_filter.po
source_lang = de
type = PO

[user_documentation.locales_en_LC_MESSAGES_tags]
file_filter = locales/<lang>/tags.po
source_file = locales/en/LC_MESSAGES/tags.po
source_lang = de
type = PO

[user_documentation.locales_en_LC_MESSAGES_invoices]
file_filter = locales/<lang>/invoices.po
source_file = locales/en/LC_MESSAGES/invoices.po
source_lang = de
type = PO

[user_documentation.locales_en_LC_MESSAGES_mailing_lists_mailchimp_export]
file_filter = locales/<lang>/mailing_lists_mailchimp_export.po
source_file = locales/en/LC_MESSAGES/mailing_lists_mailchimp_export.po
source_lang = de
type = PO

[user_documentation.locales_en_LC_MESSAGES_index]
file_filter = locales/<lang>/index.po
source_file = locales/en/LC_MESSAGES/index.po
source_lang = de
type = PO

[user_documentation.locales_fr_LC_MESSAGES_roles]
file_filter = locales/<lang>/roles.po
source_file = locales/fr/LC_MESSAGES/roles.po
source_lang = de
type = PO

[user_documentation.locales_fr_LC_MESSAGES_access_concept]
file_filter = locales/<lang>/access_concept.po
source_file = locales/fr/LC_MESSAGES/access_concept.po
source_lang = de
type = PO

[user_documentation.locales_fr_LC_MESSAGES_mailing_lists]
file_filter = locales/<lang>/mailing_lists.po
source_file = locales/fr/LC_MESSAGES/mailing_lists.po
source_lang = de
type = PO

[user_documentation.locales_fr_LC_MESSAGES_people_filter]
file_filter = locales/<lang>/people_filter.po
source_file = locales/fr/LC_MESSAGES/people_filter.po
source_lang = de
type = PO

[user_documentation.locales_fr_LC_MESSAGES_tags]
file_filter = locales/<lang>/tags.po
source_file = locales/fr/LC_MESSAGES/tags.po
[o:hitobito:p:user_documentation:r:access_concept]
file_filter = locales/<lang>/LC_MESSAGES/access_concept.po
source_file = _build/gettext/access_concept.pot
source_lang = de
type = PO
type = PO

[user_documentation.locales_fr_LC_MESSAGES_invoices]
file_filter = locales/<lang>/invoices.po
source_file = locales/fr/LC_MESSAGES/invoices.po
[o:hitobito:p:user_documentation:r:ebics]
file_filter = locales/<lang>/LC_MESSAGES/ebics.po
source_file = _build/gettext/ebics.pot
source_lang = de
type = PO
type = PO

[user_documentation.locales_fr_LC_MESSAGES_mailing_lists_mailchimp_export]
file_filter = locales/<lang>/mailing_lists_mailchimp_export.po
source_file = locales/fr/LC_MESSAGES/mailing_lists_mailchimp_export.po
[o:hitobito:p:user_documentation:r:events]
file_filter = locales/<lang>/LC_MESSAGES/events.po
source_file = _build/gettext/events.pot
source_lang = de
type = PO
type = PO

[user_documentation.locales_fr_LC_MESSAGES_index]
file_filter = locales/<lang>/index.po
source_file = locales/fr/LC_MESSAGES/index.po
[o:hitobito:p:user_documentation:r:faq]
file_filter = locales/<lang>/LC_MESSAGES/faq.po
source_file = _build/gettext/faq.pot
source_lang = de
type = PO

[user_documentation.access_concept]
file_filter = locales/<lang>/LC_MESSAGES/access_concept.po
source_file = _build/gettext/access_concept.pot
source_lang = en
type = PO
type = PO

[user_documentation.index]
[o:hitobito:p:user_documentation:r:index]
file_filter = locales/<lang>/LC_MESSAGES/index.po
source_file = _build/gettext/index.pot
source_lang = en
type = PO
source_lang = de
type = PO

[user_documentation.invoices]
[o:hitobito:p:user_documentation:r:invoices]
file_filter = locales/<lang>/LC_MESSAGES/invoices.po
source_file = _build/gettext/invoices.pot
source_lang = en
type = PO
source_lang = de
type = PO

[user_documentation.mailing_lists]
[o:hitobito:p:user_documentation:r:mailing_lists]
file_filter = locales/<lang>/LC_MESSAGES/mailing_lists.po
source_file = _build/gettext/mailing_lists.pot
source_lang = en
type = PO
source_lang = de
type = PO

[user_documentation.mailing_lists_mailchimp_export]
[o:hitobito:p:user_documentation:r:mailing_lists_mailchimp_export]
file_filter = locales/<lang>/LC_MESSAGES/mailing_lists_mailchimp_export.po
source_file = _build/gettext/mailing_lists_mailchimp_export.pot
source_lang = en
type = PO
source_lang = de
type = PO

[user_documentation.people_filter]
[o:hitobito:p:user_documentation:r:people_filter]
file_filter = locales/<lang>/LC_MESSAGES/people_filter.po
source_file = _build/gettext/people_filter.pot
source_lang = en
type = PO
source_lang = de
type = PO

[user_documentation.roles]
[o:hitobito:p:user_documentation:r:roles]
file_filter = locales/<lang>/LC_MESSAGES/roles.po
source_file = _build/gettext/roles.pot
source_lang = en
type = PO
source_lang = de
type = PO

[user_documentation.tags]
[o:hitobito:p:user_documentation:r:tags]
file_filter = locales/<lang>/LC_MESSAGES/tags.po
source_file = _build/gettext/tags.pot
source_lang = en
type = PO
source_lang = de
type = PO

[o:hitobito:p:user_documentation:r:two_factor_authentication]
file_filter = locales/<lang>/LC_MESSAGES/two_factor_authentication.po
source_file = _build/gettext/two_factor_authentication.pot
source_lang = de
type = PO

9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,12 @@ A helpful overview over the restructured syntax that we use can be found here: h
## Developer documentation for hitobito

If you are looking for the docs for development of hitobito head over to https://github.com/hitobito/hitobito/tree/master/doc

## Manual building

Ensure that you have virtualenv and rake installed. Then:

`rake build:all`

In case the translations cannot be pulled, you need to configure transifex correctly.
`rake tx:status` can help
110 changes: 110 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# frozen_string_literal: true

namespace :sources do
task extract: ['sphinx/bin/sphinx-build'] do
sh 'sphinx/bin/sphinx-build -b gettext . _build/gettext'
end

desc 'Update gettext and config from the source and push to transifex'
task update: %i[sources:extract tx:config tx:push]
end

namespace :translations do
desc 'Pull translations from transifex and commit'
task update: %i[tx:pull] do
sh 'git add locales/'
sh 'git commit -m "Update translations from transifex"'

puts 'You can now push the docs, so the website can be rebuilt.'
end
end

namespace :tx do
task push: ['bin/tx'] do
sh 'bin/tx push --source'
end

task pull: ['bin/tx'] do
sh 'bin/tx pull --translations --all --force'
end

task :config do
Rake::Task['.tx/config'].execute
end

task status: ['bin/tx'] do
sh 'bin/tx --version'
sh 'bin/tx status'
end
end

namespace :build do
task all: %i[en it fr]

task :en do
Rake::Task['build:docs'].execute(locale: 'en')
end

task :it do
Rake::Task['build:docs'].execute(locale: 'it')
end

task :fr do
Rake::Task['build:docs'].execute(locale: 'fr')
end

task :docs, [:locale] => ['sphinx/bin/sphinx-build'] do |_t, args|
locale = args[:locale]

sh "sphinx/bin/sphinx-build -b html -D language=#{locale} . _build/html/#{locale}"
end
end

directory 'bin/'

file 'bin/tx': ['bin/'] do
transifex_version = 'v1.6.4'

sh "curl -L https://github.com/transifex/cli/releases/download/#{transifex_version}/tx-linux-amd64.tar.gz | " \
'tar xz -C bin/'
end

directory '.tx/'

file '.tx/config': ['.tx/'] do |task|
organization = 'hitobito'
project = 'user_documentation'
source_lang = 'de'

header = <<~INI
[main]
host = https://www.transifex.com

INI

template = <<~INI
[o:#{organization}:p:#{project}:r:<resource>]
file_filter = locales/<lang>/LC_MESSAGES/<resource>.po
source_file = _build/gettext/<resource>.pot
source_lang = #{source_lang}
type = PO

INI

File.open(task.name, 'w') do |config|
config << header

FileList['_build/gettext/*.pot'].each do |source|
config << template.gsub('<resource>', File.basename(source, '.pot'))
end
end
end

directory 'sphinx/' do
sh 'virtualenv sphinx'
end

file 'sphinx/bin/sphinx-build': ['sphinx/'] do
sh 'sphinx/bin/pip install sphinx_rtd_theme' # ensure correct dependency resolution
sh 'sphinx/bin/pip install sphinx sphinx-intl[transifex]'
end
2 changes: 1 addition & 1 deletion access_concept.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Berechtigunskonzept
Berechtigungskonzept
=======================


Expand Down
1 change: 1 addition & 0 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
language = u'de'
locale_dir = ["locales/"]
gettext_compact = False
gettext_uuid = True

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down
Loading