User Tools

Site Tools


newdevs:i18n

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
newdevs:i18n [2023/09/15 17:59] – [1. Install Translation Files] tmccannanewdevs:i18n [2024/01/26 15:24] (current) – [Marking Up Evergreen (Angular TypeScript Pages)] tmccanna
Line 8: Line 8:
 ==== 1. Install Translation Files ==== ==== 1. Install Translation Files ====
  
-As root:+**Prerequisite:** 
 + 
 +As root, install a translation tool
   - Refresh local package cache: apt update   - Refresh local package cache: apt update
   - Navigate to /home/opensrf/Evergreen   - Navigate to /home/opensrf/Evergreen
   - Install the translator (replace "ubuntu-focal" with your OS if different): <code>make -f Open-ILS/src/extras/Makefile.install ubuntu-focal-translator</code>   - Install the translator (replace "ubuntu-focal" with your OS if different): <code>make -f Open-ILS/src/extras/Makefile.install ubuntu-focal-translator</code>
  
-As opensrf: +**Prior to installing Evergreen:** 
 + 
 +As opensrf, navigate to Evergreen/build/i18n:
   - mkdir locale   - mkdir locale
   - make newpot   - make newpot
Line 19: Line 23:
   - make LOCALE=cs-CZ install //(where cs-CZ is the language you are configuring)//   - make LOCALE=cs-CZ install //(where cs-CZ is the language you are configuring)//
  
-Either install Evergreen or, if Evergreen is already installed then sync the build files with the installed files:  +Repeat steps 2-4 for each additional language. 
-<code>rsync -auv build/i18n/po/ /openils/var/data/locale</code>+ 
 +**Copy Files**
  
 At this point, you should have PO files under:  At this point, you should have PO files under: 
-  * /openils/var/data/locale/   (subfolders for each section) +  * /Evergreen/Open-ILS/src/data/locale/   (subfolders for each section) 
-  * /openils/var/templates/locale/ (one file per section per language)+  * /Evergreen/Open-ILS/src/templates/locale/ (one file per section per language) 
 + 
 +Copy each of these folders to the corresponding location on your server. 
 +  * cp -r /home/opensrf/Evergreen/Open-ILS/src/data/locale/ /openils/var/data/ 
 +  * cp -r /home/opensrf/Evergreen/Open-ILS/src/templates/locale/ /openils/var/templates/
  
 ==== 2. Configure the Evergreen Database (if needed) ==== ==== 2. Configure the Evergreen Database (if needed) ====
Line 45: Line 54:
 VALUES ('en-PINES', 'eng', 'PINES', 'PINES English');</code> VALUES ('en-PINES', 'eng', 'PINES', 'PINES English');</code>
  
-Add the generated seed data if it was not already installed: +Add the generated seed data if it was not already installed. Navigate to /Evergreen/build/i18n/locale/cs-CZ and run:
  
-<code>psql -U evergreen -a -f build/i18n/locale/cs-CZ/950.data.seed-values.sql</code>+<code>psql -U evergreen -a -f 950.data.seed-values.sql</code>
 ==== 3. Modify eg_vhost.conf ==== ==== 3. Modify eg_vhost.conf ====
  
 +  - Switch to root
   - File location: etc/apache2/eg_vhost.conf    - File location: etc/apache2/eg_vhost.conf 
-  - Look for the "Locale messages files" section around line 650+  - Look for the "Locale messages files" section around line 700
   - Uncomment or add lines for the new languages you are adding: <code>PerlAddVar OILSWebLocale "cs_cz"   - Uncomment or add lines for the new languages you are adding: <code>PerlAddVar OILSWebLocale "cs_cz"
 PerlAddVar OILSWebLocale "/openils/var/data/locale/opac/cs-CZ.po"</code> PerlAddVar OILSWebLocale "/openils/var/data/locale/opac/cs-CZ.po"</code>
Line 63: Line 73:
 The newer Angular administration interfaces provide a button to add translations (for example, the MARC Coded Value Map controls the Audience dropdown fields in the OPAC advanced search), but you will need to edit a file in order to enable it for each language. The newer Angular administration interfaces provide a button to add translations (for example, the MARC Coded Value Map controls the Audience dropdown fields in the OPAC advanced search), but you will need to edit a file in order to enable it for each language.
  
 +  - Switch to opensrf user
   - Edit Open-ILS/src/eg2/src/environments/environment.prod.ts   - Edit Open-ILS/src/eg2/src/environments/environment.prod.ts
-  - Modify the locales array (eg, locales: ['en-US','fr-CA','es-ES']+  - Modify the locales array (eg, locales: ['en-US','cs-CZ','es-ES']
   - Recompile Angular: Go to the Open-ILS/src/eg2 folder and run: ng build   - Recompile Angular: Go to the Open-ILS/src/eg2 folder and run: ng build
          
-===== Marking Up Evergreen (Angular Pages) =====+===== Marking Up Evergreen (Angular HTML Template Pages) =====
  
 Most strings only require the addition of "i18n" to the innermost tag surrounding text:  Most strings only require the addition of "i18n" to the innermost tag surrounding text: 
Line 84: Line 95:
   * [[https://git.evergreen-ils.org/?p=working/Evergreen.git;a=commitdiff;h=a581623b2cfd56d072a1c3b00ad138811a448d50|LP#1951307: Contextual confirm dialog button text]]   * [[https://git.evergreen-ils.org/?p=working/Evergreen.git;a=commitdiff;h=a581623b2cfd56d072a1c3b00ad138811a448d50|LP#1951307: Contextual confirm dialog button text]]
  
 +===== Marking Up Evergreen (Angular TypeScript Pages) =====
 +
 +When creating a message in TypeScript, use the $localize tag handler with backticks around the text. 
 +
 +Example: 
 +<code>warning_msg = $localize`Watch out!`;</code>
 +
 +Example:
 +<code>warning_msg = $localize`There is a problem with ${this.barcode}`;</code>
  
 ===== Marking Up Evergreen (Template Toolkit Pages) ===== ===== Marking Up Evergreen (Template Toolkit Pages) =====
Line 92: Line 112:
 ===== Translating Strings in Launchpad ===== ===== Translating Strings in Launchpad =====
  
-Evergreen translation files are stored in Launchpad.+Evergreen translation files are stored in Launchpad. They are downloaded and brought into Evergreen as PO files
  
   * [[https://translations.launchpad.net/evergreen|Launchpad - Translations]]   * [[https://translations.launchpad.net/evergreen|Launchpad - Translations]]
  
-Evergreen manages translation files through POEditor. +You can add or update translations directly in Launchpad one string at a time or edit them locally with POEditor and then upload them
  
   * [[https://poeditor.com/join/project/2FlOsiPYag|POEditor site]]   * [[https://poeditor.com/join/project/2FlOsiPYag|POEditor site]]
Line 111: Line 131:
   * [[evergreen-admin:customizations:i18n|Internationalization (I18N), Localization (L10N), and Globalization (G11N)]]   * [[evergreen-admin:customizations:i18n|Internationalization (I18N), Localization (L10N), and Globalization (G11N)]]
   * [[:eg_translations|Evergreen Translations]]   * [[:eg_translations|Evergreen Translations]]
 +  * Presentation: Localization Is So Much More Than Just Translation - [[https://tinyurl.com/evergreentranslation|Slides]] - [[https://youtu.be/hqmWpFEXL48|Video]]
  
  
  
  
-===== More Things to add to this page: ===== 
- 
-  * Links to Evergreen Conference session recordings about internationalization 
-  * Info from slides at https://docs.google.com/presentation/d/1sL2trH9ERxXnifmIAvNiqyhXl-xos7-2ZyDXAjCDsdU/edit?usp=sharing 
  
  
-WIP: 
  
-Translations are managed in [[https://translations.launchpad.net/evergreen/|Launchpad]]. Download the most current files:  
-  - Go to https://translations.launchpad.net/evergreen 
-  - Click on the "View All Languages" link on the lower-right of the page 
-  - Select tpac (which contains the translated strings for the OPAC) and then choose the option to Download Translation in PO format. It will be mailed to you and may take an hour or more to arrive. 
-  - Go back to webstaff (which contains the translated strings for the staff client) and request a download of that PO file as well. 
  
-When the files arrive: 
-  - Change the name of the PO files to match the language code (e.g., cs-CZ.po for Czech or es-ES.po for Spanish). 
-  - Save the tpac download to: /openils/var/data/locale/opac/[your new filename] 
-  - Save the webstaff download to: /openils/var/data/locale/staff/[your new filename] 
newdevs/i18n.1694815162.txt.gz · Last modified: 2023/09/15 17:59 by tmccanna

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki

© 2008-2022 GPLS and others. Evergreen is open source software, freely licensed under GNU GPLv2 or later.
The Evergreen Project is a U.S. 501(c)3 non-profit organization.