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 18:25] – [Additional Resources] 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 ====
  
-Prior to install:+**Prerequisite:**
  
-As root:+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>
 +
 +**Prior to installing Evergreen:**
  
 As opensrf, navigate to Evergreen/build/i18n: As opensrf, navigate to Evergreen/build/i18n:
Line 21: 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)//
  
-Install Evergreen.+Repeat steps 2-4 for each additional language. 
 + 
 +**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 46: 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 64: 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 85: 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) =====
newdevs/i18n.1694816755.txt.gz · Last modified: 2023/09/15 18:25 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.