From 29545f7a01a28af984ac345976e2d28bba1c9c6b Mon Sep 17 00:00:00 2001
From: Andreas Roussos <a.roussos@dataly.gr>
Date: Wed, 15 Apr 2020 09:46:50 +0200
Subject: [PATCH] Bug 25149: Fix Zebra language code for Greek

According to the list of two-letter language codes found in ISO 639-1
(https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes), the correct
Zebra language option for Greek should be 'el', not 'gr'.

This patch fixes that.

Test plan:
0) Apply the patch.
1) Confirm that 'gr' has been changed to 'el' in all relevant files.
2) Create a new Koha instance using `koha-create --zebralang el testinst1`.
3) Edit /etc/koha/koha-sites.conf and set ZEBRA_LANGUAGE to 'el'. Then,
   create another Koha instance with `koha-create testinst2`.
4) Confirm that both instances created in steps 2) and 3) have picked up
   the Zebra CHR file from the /etc/koha/zebradb/lang_defs/el/ directory.
   This is done by inspecting the value of 'profilePath' in these files:
   /etc/koha/sites/testinst{1,2}/zebra-authorities-dom.cfg
   /etc/koha/sites/testinst{1,2}/zebra-biblios-dom.cfg

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
---
 Makefile.PL                                          | 2 +-
 debian/docs/koha-create.xml                          | 2 +-
 debian/scripts/koha-create                           | 2 +-
 debian/templates/koha-sites.conf                     | 2 +-
 etc/zebradb/lang_defs/{gr => el}/sort-string-utf.chr | 0
 5 files changed, 4 insertions(+), 4 deletions(-)
 rename etc/zebradb/lang_defs/{gr => el}/sort-string-utf.chr (100%)

diff --git a/Makefile.PL b/Makefile.PL
index 4c52f0e04e..ad98d8b6d3 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -535,7 +535,7 @@ my %valid_config_values = (
   'DB_USE_TLS' => {'yes', 'no'},
   'INSTALL_SRU' => { 'yes' => 1, 'no' => 1 },
   'ZEBRA_MARC_FORMAT' => { 'marc21' => 1, 'normarc' => 1, 'unimarc' => 1 }, # FIXME should generate from contents of distributation
-  'ZEBRA_LANGUAGE'    => { 'cs' => 1, 'en' => 1, 'es' => 1, 'fr' => 1, 'gr' => 1, 'nb' => 1, 'ru' => 1, 'uk' => 1 }, # FIXME should generate from contents of distribution
+  'ZEBRA_LANGUAGE'    => { 'cs' => 1, 'el' => 1, 'en' => 1, 'es' => 1, 'fr' => 1, 'nb' => 1, 'ru' => 1, 'uk' => 1 }, # FIXME should generate from contents of distribution
   'ZEBRA_TOKENIZER' => { chr => 1, icu => 1 },
   'RUN_DATABASE_TESTS' => { 'yes' => 1, 'no' => 1 },
   'USE_MEMCACHED'      => { 'yes' => 1, 'no' => 1 },
diff --git a/debian/docs/koha-create.xml b/debian/docs/koha-create.xml
index c5be386648..f37eb206cd 100644
--- a/debian/docs/koha-create.xml
+++ b/debian/docs/koha-create.xml
@@ -26,7 +26,7 @@
       <command>koha-create</command>
       <arg choice="req"><option>--create-db</option>|<option>--request-db</option>|<option>--populate-db</option>|<option>--use-db</option></arg>
       <arg><option>--marcflavor</option> marc21|normarc|unimarc</arg>
-      <arg><option>--zebralang</option> en|es|fr|gr|nb|ru|uk</arg>
+      <arg><option>--zebralang</option> el|en|es|fr|nb|ru|uk</arg>
       <arg><option>--memcached-servers</option> server:port</arg>
       <arg><option>--memcached-prefix</option> namespace_prefix</arg>
       <arg><option>--elasticsearch-server</option> server:port</arg>
diff --git a/debian/scripts/koha-create b/debian/scripts/koha-create
index a4f1220dfc..43d58fd2b5 100755
--- a/debian/scripts/koha-create
+++ b/debian/scripts/koha-create
@@ -52,7 +52,7 @@ Options:
   --marcflavor flavor       Set the MARC flavor. Valid values are marc21 (default),
                             normarc and unimarc.
   --zebralang lang          Choose the primary language for Zebra indexing. Valid
-                            values are cs, en (default), es, fr, gr, nb, ru and uk.
+                            values are cs, el, en (default), es, fr, nb, ru and uk.
   --elasticsearch-server s  Enforce the use of the specified Elasticsearch server(s)
                             (default: localhost:9200).
   --memcached-servers str   Set a comma-separated list of host:port memcached servers.
diff --git a/debian/templates/koha-sites.conf b/debian/templates/koha-sites.conf
index 3be4c55d73..23ec0a5303 100644
--- a/debian/templates/koha-sites.conf
+++ b/debian/templates/koha-sites.conf
@@ -28,7 +28,7 @@ DEFAULTSQL=""
 # default: 'marc21'
 ZEBRA_MARC_FORMAT="marc21"
 
-# ZEBRA_LANGUAGE: 'cs' | 'en' | 'es' | 'fr' | 'gr' | 'nb' | 'ru' | 'uk'
+# ZEBRA_LANGUAGE: 'cs' | 'el' | 'en' | 'es' | 'fr' | 'nb' | 'ru' | 'uk'
 # Primary language for Zebra indexing
 # default: 'en'
 ZEBRA_LANGUAGE="en"
diff --git a/etc/zebradb/lang_defs/gr/sort-string-utf.chr b/etc/zebradb/lang_defs/el/sort-string-utf.chr
similarity index 100%
rename from etc/zebradb/lang_defs/gr/sort-string-utf.chr
rename to etc/zebradb/lang_defs/el/sort-string-utf.chr
-- 
2.17.1