Discussion:
[Koha] Adding languages to Advanced Search
Rubén Fernández Asensio
2018-08-18 19:21:25 UTC
Permalink
Hello again!
I'm still trying to customize the Advanced Search.
Now I need to add a language to the language search field. For some
reason, it doesn't show Esperanto ("epo" according to ISO-639-2).

Taking a look at file
/usr/share/koha/opac/htdocs/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt,
which seems to govern Advanced Search interface, I find this:

<fieldset>
<legend>Language</legend>
<!-- LANGUAGE LIMIT -->
<p>
<label for="language-limit">Language: </label>
<select id="language-limit" name="limit">
<option value="">No limit</option>
[% FOREACH search_languages_loo IN
search_languages_loop %] [% IF ( search_languages_loo.selected ) %]
<option value="ln,rtrn:[%
search_languages_loo.iso639_2_code %]" selected="selected">[%
search_languages_loo.language_description %]</option>
[% ELSE %]
<option value="ln,rtrn:[%
search_languages_loo.iso639_2_code %]">[%
search_languages_loo.language_description %]</option>
[% END %]
[% END %]
</select>
</p>
<!-- /LANGUAGE LIMIT -->
</fieldset>

So, what should I do to add a language and its description to the list,
or at least to take a look at the built-in list "search_languages_loop"?

Also, is there any way of writing code to select "any language but X"?

Rubén
_______________________________________________
Koha mailing list http://koha-community.org
***@lists.katipo.co.nz
https://li
Katrin Fischer
2018-08-19 19:42:57 UTC
Permalink
Hi Rubén,

you can add new entries to the pull down list using jQuery or you can
add your new language to the database. The language list is created
using data from the db, including the translations. I've found an old
bug for you that adds a new language as an example:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14030

Hope that helps,

Katrin
Post by Rubén Fernández Asensio
Hello again!
I'm still trying to customize the Advanced Search.
Now I need to add a language to the language search field. For some
reason, it doesn't show Esperanto ("epo" according to ISO-639-2).
Taking a look at file
/usr/share/koha/opac/htdocs/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt,
<fieldset>
  <legend>Language</legend>
    <!-- LANGUAGE LIMIT -->
      <p>
     <label for="language-limit">Language: </label>
         <select id="language-limit" name="limit">
             <option value="">No limit</option>
                   [% FOREACH search_languages_loo IN
search_languages_loop %] [% IF ( search_languages_loo.selected ) %]
                <option value="ln,rtrn:[%
search_languages_loo.iso639_2_code %]" selected="selected">[%
search_languages_loo.language_description %]</option>
                                                [% ELSE %]
                <option value="ln,rtrn:[%
search_languages_loo.iso639_2_code %]">[%
search_languages_loo.language_description %]</option>
                     [% END %]
                                            [% END %]
          </select>
       </p>
     <!-- /LANGUAGE LIMIT -->
</fieldset>
So, what should I do to add a language and its description to the
list, or at least to take a look at the built-in list
"search_languages_loop"?
Also, is there any way of writing code to select "any language but X"?
Rubén
_______________________________________________
Koha mailing list  http://koha-community.org
https://lists.katipo.co.nz/mailman/listinfo/koha
Rubén Fernández Asensio
2018-08-20 05:58:45 UTC
Permalink
Thanks, Katrin, but I'm not a programmer! I know nothing about jQuery or
patches. Do you mean I must recompile the entire Koha from sources?
Can't it be done just by editing a few configuration files?
Post by Katrin Fischer
Hi Rubén,
you can add new entries to the pull down list using jQuery or you can
add your new language to the database. The language list is created
using data from the db, including the translations. I've found an old
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14030
Hope that helps,
Katrin
Post by Rubén Fernández Asensio
Hello again!
I'm still trying to customize the Advanced Search.
Now I need to add a language to the language search field. For some
reason, it doesn't show Esperanto ("epo" according to ISO-639-2).
Taking a look at file
/usr/share/koha/opac/htdocs/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt,
<fieldset>
  <legend>Language</legend>
    <!-- LANGUAGE LIMIT -->
      <p>
     <label for="language-limit">Language: </label>
         <select id="language-limit" name="limit">
             <option value="">No limit</option>
                   [% FOREACH search_languages_loo IN
search_languages_loop %] [% IF ( search_languages_loo.selected ) %]
                <option value="ln,rtrn:[%
search_languages_loo.iso639_2_code %]" selected="selected">[%
search_languages_loo.language_description %]</option>
                                                [% ELSE %]
                <option value="ln,rtrn:[%
search_languages_loo.iso639_2_code %]">[%
search_languages_loo.language_description %]</option>
                     [% END %]
                                            [% END %]
          </select>
       </p>
     <!-- /LANGUAGE LIMIT -->
</fieldset>
So, what should I do to add a language and its description to the
list, or at least to take a look at the built-in list
"search_languages_loop"?
Also, is there any way of writing code to select "any language but X"?
Rubén
_______________________________________________
Koha mailing list  http://koha-community.org
https://lists.katipo.co.nz/mailman/listinfo/koha
_______________________________________________
Koha mailing list  http://koha-community.org
https://lists.katipo.co.nz/mailman/listinfo/koha
_______________________________________________
Koha mailing list http://koha-community.org
***@lists.katipo.co.n
Bob Birchall
2018-08-20 06:08:29 UTC
Permalink
Hi Ruben,
You will not have to recompile Koha from source.

However your objective cannot be achieved merely with configuration. The
language is not there to be configured, at present.

You've done well to get as far as you have, but to proceed you will
probably need technical support. If you do not have that inhouse, you
might find help from this directory:
https://koha-community.org/support/paid-support/

I hope this helps,
Bob
Calyx
Post by Rubén Fernández Asensio
Thanks, Katrin, but I'm not a programmer! I know nothing about jQuery
or patches. Do you mean I must recompile the entire Koha from sources?
Can't it be done just by editing a few configuration files?
Post by Katrin Fischer
Hi Rubén,
you can add new entries to the pull down list using jQuery or you can
add your new language to the database. The language list is created
using data from the db, including the translations. I've found an old
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14030
Hope that helps,
Katrin
Post by Rubén Fernández Asensio
Hello again!
I'm still trying to customize the Advanced Search.
Now I need to add a language to the language search field. For some
reason, it doesn't show Esperanto ("epo" according to ISO-639-2).
Taking a look at file
/usr/share/koha/opac/htdocs/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt,
<fieldset>
  <legend>Language</legend>
    <!-- LANGUAGE LIMIT -->
      <p>
     <label for="language-limit">Language: </label>
         <select id="language-limit" name="limit">
             <option value="">No limit</option>
                   [% FOREACH search_languages_loo IN
search_languages_loop %] [% IF ( search_languages_loo.selected ) %]
                <option value="ln,rtrn:[%
search_languages_loo.iso639_2_code %]" selected="selected">[%
search_languages_loo.language_description %]</option>
                                                [% ELSE %]
                <option value="ln,rtrn:[%
search_languages_loo.iso639_2_code %]">[%
search_languages_loo.language_description %]</option>
                     [% END %]
                                            [% END %]
          </select>
       </p>
     <!-- /LANGUAGE LIMIT -->
</fieldset>
So, what should I do to add a language and its description to the
list, or at least to take a look at the built-in list
"search_languages_loop"?
Also, is there any way of writing code to select "any language but X"?
Katrin Fischer
2018-08-20 06:09:49 UTC
Permalink
Hi Rubén,

the patch was to show the SQL that is needed in order to add a new
language, as the list is created from data in the database. Here is an
example:

Example:

INSERT IGNORE INTO language_descriptions(subtag, type, lang, description) VALUES ( 'ka', 'language', 'ka', 'ქართული');

For translations:
INSERT IGNORE INTO language_descriptions(subtag, type, lang, description) VALUES ( 'ka', 'language', 'fr', 'Géorgien');
...

You could also file a bug on bugzilla about adding Esperanto to the list for new versions.

Katrin
Post by Rubén Fernández Asensio
Thanks, Katrin, but I'm not a programmer! I know nothing about jQuery
or patches. Do you mean I must recompile the entire Koha from sources?
Can't it be done just by editing a few configuration files?
Post by Katrin Fischer
Hi Rubén,
you can add new entries to the pull down list using jQuery or you can
add your new language to the database. The language list is created
using data from the db, including the translations. I've found an old
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14030
Hope that helps,
Katrin
Post by Rubén Fernández Asensio
Hello again!
I'm still trying to customize the Advanced Search.
Now I need to add a language to the language search field. For some
reason, it doesn't show Esperanto ("epo" according to ISO-639-2).
Taking a look at file
/usr/share/koha/opac/htdocs/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt,
<fieldset>
  <legend>Language</legend>
    <!-- LANGUAGE LIMIT -->
      <p>
     <label for="language-limit">Language: </label>
         <select id="language-limit" name="limit">
             <option value="">No limit</option>
                   [% FOREACH search_languages_loo IN
search_languages_loop %] [% IF ( search_languages_loo.selected ) %]
                <option value="ln,rtrn:[%
search_languages_loo.iso639_2_code %]" selected="selected">[%
search_languages_loo.language_description %]</option>
                                                [% ELSE %]
                <option value="ln,rtrn:[%
search_languages_loo.iso639_2_code %]">[%
search_languages_loo.language_description %]</option>
                     [% END %]
                                            [% END %]
          </select>
       </p>
     <!-- /LANGUAGE LIMIT -->
</fieldset>
So, what should I do to add a language and its description to the
list, or at least to take a look at the built-in list
"search_languages_loop"?
Also, is there any way of writing code to select "any language but X"?
Rubén
_______________________________________________
Koha mailing list  http://koha-community.org
https://lists.katipo.co.nz/mailman/listinfo/koha
_______________________________________________
Koha mailing list  http://koha-community.org
https://lists.katipo.co.nz/mailman/listinfo/koha
_______________________________________________
Koha mailing list  http://koha-community.org
https://lists.katipo.co.nz/mailman/listinfo/koha
_______________________________________________
Koha mailing list http://koha-community.org
***@lists.katipo.co.nz
https:
Rubén Fernández Asensio
2018-08-20 07:34:12 UTC
Permalink
I'd rather file a bug, but adding Esperanto (and other languages) has
already been proposed:
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18493

Why is the status of that bug "Failed QA"?
I suspect the only way of having that bug fixed and Esperanto added to
Koha Advanced Search may be providing a solution myself...

OK, let's say I type something like this:

INSERT INTO language_subtag_registry( subtag, type, description, added)
VALUES ( 'eo', 'language', 'Esperanto','2018-08-20');

INSERT INTO language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code)
VALUES ( 'eo', 'epo');

INSERT INTO language_descriptions(subtag, type, lang, description)
VALUES ( 'eo', 'language', 'eo', 'Esperanto');

INSERT INTO language_descriptions(subtag, type, lang, description)
VALUES ( 'eo', 'language', 'en', 'Esperanto');

And this:

INSERT IGNORE INTO language_subtag_registry( subtag, type, description,
added) VALUES ( 'eo', 'language', 'Esperanto','2018-08-20');

INSERT IGNORE INTO
language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code) VALUES ( 'eo',
'epo');

INSERT IGNORE INTO language_descriptions(subtag, type, lang,
description) VALUES ( 'eo', 'language', 'eo', 'Esperanto');

INSERT IGNORE INTO language_descriptions(subtag, type, lang,
description) VALUES ( 'eo', 'language', 'en', 'Esperanto');

What should I do next?
Post by Katrin Fischer
INSERT IGNORE INTO language_descriptions(subtag, type, lang,
description) VALUES ( 'ka', 'language', 'ka', 'ქართული');
INSERT IGNORE INTO language_descriptions(subtag, type, lang,
description) VALUES ( 'ka', 'language', 'fr', 'Géorgien');
...
You could also file a bug on bugzilla about adding Esperanto to the list for new versions.
Katrin
_______________________________________________
Koha mailing list http://koha-community.org
***@lists.katipo.co.nz
h
Katrin Fischer
2018-08-22 05:48:28 UTC
Permalink
Hi Rubén,

first and second look the same to me? It looks about right. I just ran
the SQL in my test database and Esperanto showed up in the language pull
down.

Katrin
Post by Rubén Fernández Asensio
I'd rather file a bug, but adding Esperanto (and other languages) has
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18493
Why is the status of that bug "Failed QA"?
I suspect the only way of having that bug fixed and Esperanto added to
Koha Advanced Search may be providing a solution myself...
INSERT INTO language_subtag_registry( subtag, type, description,
added) VALUES ( 'eo', 'language', 'Esperanto','2018-08-20');
INSERT INTO language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code)
VALUES ( 'eo', 'epo');
INSERT INTO language_descriptions(subtag, type, lang, description)
VALUES ( 'eo', 'language', 'eo', 'Esperanto');
INSERT INTO language_descriptions(subtag, type, lang, description)
VALUES ( 'eo', 'language', 'en', 'Esperanto');
INSERT IGNORE INTO language_subtag_registry( subtag, type,
description, added) VALUES ( 'eo', 'language', 'Esperanto','2018-08-20');
INSERT IGNORE INTO
language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code) VALUES (
'eo', 'epo');
INSERT IGNORE INTO language_descriptions(subtag, type, lang,
description) VALUES ( 'eo', 'language', 'eo', 'Esperanto');
INSERT IGNORE INTO language_descriptions(subtag, type, lang,
description) VALUES ( 'eo', 'language', 'en', 'Esperanto');
What should I do next?
Post by Katrin Fischer
INSERT IGNORE INTO language_descriptions(subtag, type, lang,
description) VALUES ( 'ka', 'language', 'ka', 'ქართული');
INSERT IGNORE INTO language_descriptions(subtag, type, lang,
description) VALUES ( 'ka', 'language', 'fr', 'Géorgien');
...
You could also file a bug on bugzilla about adding Esperanto to the
list for new versions.
Katrin
_______________________________________________
Koha mailing list  http://koha-community.org
https://lists.katipo.co.nz/mailman/listinfo/koha
_______________________________________________
Koha mailing list http://koha-community.org
***@lists.katipo.co.nz
https://lists.katipo.co.nz/mail
Rubén Fernández Asensio
2018-08-22 13:38:15 UTC
Permalink
Thanks Katrin!
I think the "IGNORE" version isn't necessary, it may be related to the
case of collision between Georgian and Kannada codes in the example you
pointed to.
I'll try running the SQL command in my own test server.
Also, what code would it be to delete a language from the list?
Given that there are 7000 languages in the world, if only 1000 are
written, that's still unwieldly for a drop-down menu... That's why I'm
unsure about submitting a bug report and having Esperanto added to the
default interface. It should be easier to customise this though.

Ruben
Post by Katrin Fischer
Hi Rubén,
first and second look the same to me? It looks about right. I just ran
the SQL in my test database and Esperanto showed up in the language pull
down.
Katrin
Post by Rubén Fernández Asensio
I'd rather file a bug, but adding Esperanto (and other languages) has
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18493
Why is the status of that bug "Failed QA"?
I suspect the only way of having that bug fixed and Esperanto added to
Koha Advanced Search may be providing a solution myself...
INSERT INTO language_subtag_registry( subtag, type, description,
added) VALUES ( 'eo', 'language', 'Esperanto','2018-08-20');
INSERT INTO language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code)
VALUES ( 'eo', 'epo');
INSERT INTO language_descriptions(subtag, type, lang, description)
VALUES ( 'eo', 'language', 'eo', 'Esperanto');
INSERT INTO language_descriptions(subtag, type, lang, description)
VALUES ( 'eo', 'language', 'en', 'Esperanto');
INSERT IGNORE INTO language_subtag_registry( subtag, type,
description, added) VALUES ( 'eo', 'language', 'Esperanto','2018-08-20');
INSERT IGNORE INTO
language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code) VALUES (
'eo', 'epo');
INSERT IGNORE INTO language_descriptions(subtag, type, lang,
description) VALUES ( 'eo', 'language', 'eo', 'Esperanto');
INSERT IGNORE INTO language_descriptions(subtag, type, lang,
description) VALUES ( 'eo', 'language', 'en', 'Esperanto');
What should I do next?
Post by Katrin Fischer
INSERT IGNORE INTO language_descriptions(subtag, type, lang,
description) VALUES ( 'ka', 'language', 'ka', 'ქართული');
INSERT IGNORE INTO language_descriptions(subtag, type, lang,
description) VALUES ( 'ka', 'language', 'fr', 'Géorgien');
...
You could also file a bug on bugzilla about adding Esperanto to the
list for new versions.
Katrin
_______________________________________________
Koha mailing list  http://koha-community.org
https://lists.katipo.co.nz/mailman/listinfo/koha
_______________________________________________
Koha mailing list  http://koha-community.org
https://lists.katipo.co.nz/mailman/listinfo/koha
_______________________________________________
Koha mailing list http://koha-community.org
***@lists.katipo.co.nz
h
Katrin Fischer
2018-08-23 06:36:56 UTC
Permalink
Hi Rubén,

we have the AdvancedSearchLanguages system preference to allow
configuration of the languages shown in the pull down. You enter the
language codes for the languages you want to show - so it's easy and
adding a new language doesn't change existing installations.

Katrin
Post by Rubén Fernández Asensio
Thanks Katrin!
I think the "IGNORE" version isn't necessary, it may be related to the
case of collision between Georgian and Kannada codes in the example
you pointed to.
I'll try running the SQL command in my own test server.
Also, what code would it be to delete a language from the list?
Given that there are 7000 languages in the world, if only 1000 are
written, that's still unwieldly for a drop-down menu... That's why I'm
unsure about submitting a bug report and having Esperanto added to the
default interface. It should be easier to customise this though.
Ruben
Post by Katrin Fischer
Hi Rubén,
first and second look the same to me? It looks about right. I just
ran the SQL in my test database and Esperanto showed up in the
language pull down.
Katrin
Post by Rubén Fernández Asensio
I'd rather file a bug, but adding Esperanto (and other languages)
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18493
Why is the status of that bug "Failed QA"?
I suspect the only way of having that bug fixed and Esperanto added
to Koha Advanced Search may be providing a solution myself...
INSERT INTO language_subtag_registry( subtag, type, description,
added) VALUES ( 'eo', 'language', 'Esperanto','2018-08-20');
INSERT INTO language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code)
VALUES ( 'eo', 'epo');
INSERT INTO language_descriptions(subtag, type, lang, description)
VALUES ( 'eo', 'language', 'eo', 'Esperanto');
INSERT INTO language_descriptions(subtag, type, lang, description)
VALUES ( 'eo', 'language', 'en', 'Esperanto');
INSERT IGNORE INTO language_subtag_registry( subtag, type,
description, added) VALUES ( 'eo', 'language',
'Esperanto','2018-08-20');
INSERT IGNORE INTO
language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code) VALUES (
'eo', 'epo');
INSERT IGNORE INTO language_descriptions(subtag, type, lang,
description) VALUES ( 'eo', 'language', 'eo', 'Esperanto');
INSERT IGNORE INTO language_descriptions(subtag, type, lang,
description) VALUES ( 'eo', 'language', 'en', 'Esperanto');
What should I do next?
Post by Katrin Fischer
INSERT IGNORE INTO language_descriptions(subtag, type, lang,
description) VALUES ( 'ka', 'language', 'ka', 'ქართული');
INSERT IGNORE INTO language_descriptions(subtag, type, lang,
description) VALUES ( 'ka', 'language', 'fr', 'Géorgien');
...
You could also file a bug on bugzilla about adding Esperanto to the
list for new versions.
Katrin
_______________________________________________
Koha mailing list  http://koha-community.org
https://lists.katipo.co.nz/mailman/listinfo/koha
_______________________________________________
Koha mailing list  http://koha-community.org
https://lists.katipo.co.nz/mailman/listinfo/koha
_______________________________________________
Koha mailing list  http://koha-community.org
https://lists.katipo.co.nz/mailman/listinfo/koha
_______________________________________________
Koha mailing list http://koha-community.org
***@lists.katipo.co.nz
https://li

Continue reading on narkive:
Loading...