Skip to content

Commit

Permalink
Add support for i18n and locales
Browse files Browse the repository at this point in the history
Specify which locales you want in your settings.yml config file. I added
four example locales for testing purposes.

Signed-off-by: Ben Shum <ben@evergreener.net>
  • Loading branch information
bshum authored and berick committed Oct 4, 2017
1 parent 7ee9230 commit 89d2060
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 1 deletion.
24 changes: 24 additions & 0 deletions evergreen/apache.yml
Expand Up @@ -9,6 +9,30 @@
copy:
src: "{{repo_base}}/Evergreen/Open-ILS/examples/apache_24/eg_vhost_24.conf"
dest: /etc/apache2/eg_vhost.conf
- name: Setup "{{ locale }}" for TPAC
vars:
eg_locale: "{{ item | lower | regex_replace('(\\w{2})-(\\w{2})', '\\1_\\2') }}"
blockinfile:
dest: /etc/apache2/eg_vhost.conf
insertafter: ' #PerlAddVar OILSWebLocale "/openils/var/data/locale/opac/fr-CA.po"'
marker: "# {mark} ANSIBLE MANAGED BLOCK TPAC {{ item }}"
block: |
PerlAddVar OILSWebLocale "{{ eg_locale }}"
PerlAddVar OILSWebLocale "/openils/var/data/locale/opac/{{ item }}.po"
with_items: "{{ locale }}"
when: locale is defined
- name: Setup "{{ locale }}" for web staff client
vars:
staff_eg_locale: "{{ item | lower | regex_replace('(\\w{2})-(\\w{2})', '\\1_\\2') }}"
blockinfile:
dest: /etc/apache2/eg_vhost.conf
insertafter: ' #PerlAddVar OILSWebLocale "/openils/var/data/locale/staff/fr-CA.po"'
marker: "# {mark} ANSIBLE MANAGED BLOCK WEBSTAFF {{ item }}"
block: |
PerlAddVar OILSWebLocale "{{ staff_eg_locale }}"
PerlAddVar OILSWebLocale "/openils/var/data/locale/staff/{{ item }}.po"
with_items: "{{ locale }}"
when: locale is defined
- name: Setup eg_startup
copy:
src: "{{repo_base}}/Evergreen/Open-ILS/examples/apache/eg_startup"
Expand Down
9 changes: 8 additions & 1 deletion evergreen/database.yml
Expand Up @@ -61,4 +61,11 @@
when:
- create_schema
- install_pgtap

- name: Install "{{ locale }}" locale(s) in database
become: true
become_user: postgres
shell: >
cd {{repo_base}}/Evergreen/Open-ILS/src/sql/Pg
&& psql -d {{database_database}} -f 950.data.seed-values-{{ item }}.sql
with_items: "{{ locale }}"
when: locale is defined
14 changes: 14 additions & 0 deletions evergreen/eg-translator.yml
@@ -0,0 +1,14 @@
- name: Install Evergreen Translator Prereqs
shell: >
cd {{repo_base}}/Evergreen
&& PERL_MM_USE_DEFAULT=1 make -f
Open-ILS/src/extras/Makefile.install {{os_build_target}}-translator
- name: Set ownership of {{repo_base}} to opensrf
file: dest="{{repo_base}}" owner=opensrf group=opensrf recurse=yes
- name: Install specified "{{ locale }}" locale(s)
become: true
become_user: opensrf
shell: >
cd {{repo_base}}/Evergreen/build/i18n
&& make LOCALE="{{ item }}" install
with_items: "{{ locale }}"
3 changes: 3 additions & 0 deletions evergreen/main.yml
Expand Up @@ -2,6 +2,9 @@
include: eg-build.yml
- name: Build Evergreen Web
include: eg-web.yml
- name: Build Evergreen translator
include: eg-translator.yml
when: locale is defined
- name: Install Evergreen
include: eg-install.yml
- name: Setup Apache
Expand Down
7 changes: 7 additions & 0 deletions settings.yml
Expand Up @@ -52,3 +52,10 @@ load_sample_data: --load-all-sample
# Requires create_schema:true
install_pgtap: true
# --------------------------------------------------------------------------

# optional: set some example locales
locale:
- ar-JO
- cs-CZ
- es-ES
- fr-CA

0 comments on commit 89d2060

Please sign in to comment.