<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Tim,<br>
      <br>
      Now that I got illuminated (:-P) by the video regarding EPrints'
      virtual fields, I am trying to think how I could take advantage of
      them in order to use to solve my multilanguage-fields problem, and
      I think I'm a bit stuck.<br>
      <br>
      I'll speak my thoughts out loud and please correct me if I'm
      wrong. Let the target field be the "title". <br>
      <br>
      So, we need the title to be stored in more than one languages in
      the database, which should be "easily" accomplished using a
      multi-row field. Hence, multilang fields are a perfect candidate
      for this. We therefore create a new field, let's say ml_title (as
      you proposed) and store our values in it. Now, in order for
      EPrints not to break, we change the title field to be a virtual
      field and compose its output based on ml_title field. In the end,
      we'll have two fields for the title. The title field (of type
      virtualfield) that will be calculating its value each time it's
      called, and the ml_title field (of type multilang). Is that
      correct?<br>
      <br>
      Now that I've written my thoughts, I think I'm no more stuck and I
      see that your idea is brilliant and very easy!! :):). And if the
      above paragraph is not your idea, and it's even easier than that,
      then it'll be even more brilliant!! :):)<br>
      <br>
      Cheers again, I'll give it a try on Monday!<br>
      <br>
      Once again, nice work Adam and thanks Tim and all of you for your
      help!<br>
      <br>
      PS. It would be extremely beneficial if there were a guide as to
      how EPrints' internals work. Something that is a little be more
      explanatory than the "anatomy of a request
      (<a class="moz-txt-link-freetext" href="http://wiki.eprints.org/w/Anatomy_of_a_request">http://wiki.eprints.org/w/Anatomy_of_a_request</a>)" and explain how
      the coders of EPrints really think of EPrints in their minds.<br>
      <br>
      On 25/06/2015 11:42 πμ, Timothy Miles-Board wrote:<br>
    </div>
    <blockquote
cite="mid:EMEW3|b64ed13f54bc5a8a7f94848fe4a4327dr5O9hK14eprints-tech-bounces|ecs.soton.ac.uk|DB4PR05MB073553825CBD4FD9ECA4944382AE0@DB4PR05MB0735.eurprd05.prod.outlook.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
      <div id="divtagdefaultwrapper"
style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
        <p>The "problem" is that when you ask $eprint-&gt;get_value()
          for the value of a multilang field it gives you a perl data
          structure - in this case arrayref (array of
          {langcode=&gt;text} hashrefs) - ie. the same behaviour as you
          would expect for a compound field or any field with a multiple
          value.</p>
        <p><br>
        </p>
        <p>$eprint-&gt;get_value() is used everywhere - including in
          export plugins. So any field where the plugin implicitly
          expects a string - like title, abstract etc - it will output
          something like ARRAYx01123123</p>
        <p><br>
        </p>
        <p>So your options are:</p>
        <p><br>
        </p>
        <p>* Fix up all the plugins to be cleverer about how they get
          the "best" value of multilang field (ie. use get_value() then
          look at the user's lang / default lang to pull out the best
          string from the multilang structure) - but this would mean
          repeating the same routine in every plugin..</p>
        <p><br>
        </p>
        <p>* Change the way that get_value() works so that it somehow
          decides which behaviour to use (arrayref vs best lang string)
          based on calling context etc. - get_value is used everywhere
          in EPrints so this would probably break everything..</p>
        <p><br>
        </p>
        <p>* Add a layer of abstraction between the low level
          get_value() and the plugins that defines an API for returning
          language dependent strings - then change all the plugins to
          use that (so instead of get_value(), plugins could call
          get_lang_string() or something - something like this would be
          the best approach...</p>
        <p><br>
        </p>
        <p>In the meantime, what you could do is instead of changing the
          default title, abstract etc fields, just define new multilang
          versions.</p>
        <p><br>
        </p>
        <p>So eg. ml_title, ml_abstract ...</p>
        <p><br>
        </p>
        <p>Then use these in your workflow instead of the default title,
          abstract .. etc.</p>
        <p><br>
        </p>
        <p>Finally in eprint_fields_automatic.pl, write some code to
          take the ml_* fields and populate the equivalent scalar
          fields. So eg. get the value of ml_title, pull out the text in
          the default language (or if the default language version is
          not defined, some other language in order of preference - the
          EPrints::Language module already does stuff like this with
          phrases) and write that value into the title field.</p>
        <p><br>
        </p>
        <p>Then anything that expects $eprint-&gt;get_value( "title" )
          to return a string will be happy (albeit they will always give
          the default/preferred language).</p>
        <p><br>
        </p>
        <p>Or...</p>
        <p><br>
        </p>
        <p>Change the default title, abstract etc. fields to a virtual
          field so that you can dynamically work out the (string) value
          by looking at ml_title, ml_abstract etc - as long as the value
          returned is always a string this shouldn't break anything.</p>
        <p><br>
        </p>
        <p>Food for thought I hope,</p>
        <p><br>
        </p>
        <p>Tim</p>
        <p><br>
        </p>
        <div id="Signature">
          <div id="divtagdefaultwrapper" style="font-size:12pt;
            color:#000000; background-color:#FFFFFF;
            font-family:Calibri,Arial,Helvetica,sans-serif">
            <div><strong style="color:rgb(33,33,33); font-family:'Times
                New Roman',serif"><span style="font-size:11pt;
                  font-family:Calibri,sans-serif; color:rgb(31,73,125)">Timothy
                  Miles-Board</span></strong><br>
            </div>
            <div>
              <p class="x_MsoNormal" style="margin:0cm 0cm 0.0001pt;
                font-size:16px; font-family:'Times New Roman',serif;
                color:rgb(33,33,33); background-color:rgb(255,255,255)">
                <span style="font-size:10pt;
                  font-family:Calibri,sans-serif;
                  font-variant:small-caps; color:rgb(31,73,125);
                  letter-spacing:1pt">Web &amp; Repositories Development
                  Specialist, University of London Computer Centre</span><strong><span
                    style="font-size:10pt;
                    font-family:Calibri,sans-serif;
                    color:rgb(31,73,125)"></span></strong></p>
              <p class="x_MsoNormal" style="margin:0cm 0cm 0.0001pt;
                font-size:16px; font-family:'Times New Roman',serif;
                color:rgb(33,33,33); background-color:rgb(255,255,255)">
                <span style="font-size:11pt;
                  font-family:Calibri,sans-serif; color:rgb(31,73,125)">020
                  7863 1342  |  07742 970 351  | </span><span
                  style="font-size:11pt; font-family:Calibri,sans-serif;
                  color:rgb(22,139,186)"><a moz-do-not-send="true"
                    href="mailto:timothy.miles-board@london.ac.uk"
                    target="_blank"
                    title="mailto:timothy.miles-board@london.ac.uk
                    Ctrl+Click or tap to follow the link">timothy.miles-board@london.ac.uk</a> |

                  @drtjmb</span><span style="font-size:11pt;
                  font-family:Calibri,sans-serif; color:rgb(31,73,125)"></span></p>
              <p class="x_MsoNormal" style="margin:0cm 0cm 0.0001pt;
                font-size:16px; font-family:'Times New Roman',serif;
                color:rgb(33,33,33); background-color:rgb(255,255,255)">
                <span style="font-size:10pt;
                  font-family:Calibri,sans-serif; color:rgb(31,73,125)">The
                  University of London is an exempt charity in England
                  and Wales</span></p>
            </div>
          </div>
        </div>
        <br>
        <br>
        <div style="color: rgb(0, 0, 0);">
          <hr tabindex="-1" style="display:inline-block; width:98%">
          <div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
              color="#000000" face="Calibri, sans-serif"><b>From:</b>
              <a class="moz-txt-link-abbreviated" href="mailto:eprints-tech-bounces@ecs.soton.ac.uk">eprints-tech-bounces@ecs.soton.ac.uk</a>
              <a class="moz-txt-link-rfc2396E" href="mailto:eprints-tech-bounces@ecs.soton.ac.uk">&lt;eprints-tech-bounces@ecs.soton.ac.uk&gt;</a> on behalf of
              George Mamalakis <a class="moz-txt-link-rfc2396E" href="mailto:mamalos@eng.auth.gr">&lt;mamalos@eng.auth.gr&gt;</a><br>
              <b>Sent:</b> 25 June 2015 8:38 AM<br>
              <b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:eprints-tech@ecs.soton.ac.uk">eprints-tech@ecs.soton.ac.uk</a><br>
              <b>Subject:</b> [EP-tech] Re: [spam?] Re: How to set a
              field to be multilang</font>
            <div> </div>
          </div>
          <div>
            <div class="moz-cite-prefix">Thanks Alen, I'll look into it
              deeper.<br>
              <br>
              It's sad, though, that default Import/Export plugins
              break. Could you give a few hints on how to customise
              these plugins? (general guidelines). Could the changes be
              applied on the parent Import and Export plugin, or most
              child plugins tend to override functions dealing with
              title, abstract, etc?<br>
              <br>
              And that being the case, isn't it equivalent to adding
              extra fields for an additional language? Either way same
              things are broken, right? :)<br>
              <br>
              Lastly, where are these metadata fields stored in the
              database? Reading the article in the link you provided
              diagonally, it seems that I need to update the database in
              order to create them, right?<br>
              <br>
              Thanks again!<br>
              <br>
              On 24/06/2015 11:18 μμ, Alen Vodopijevec wrote:<br>
            </div>
            <blockquote type="cite">Hi!<br>
              <br>
              You have Metadata Field Types documented here:<br>
              <a moz-do-not-send="true"
                href="http://wiki.eprints.org/w/Category:EPrints_Metadata_Fields">http://wiki.eprints.org/w/Category:EPrints_Metadata_Fields</a><br>
              <br>
              But, be aware that changing title, keywords and abstract
              fields to <br>
              'compound' breaks default EPrints plugins - export/import
              .. these <br>
              plugins expect title/keywords/abstract to be simple and
              not compound <br>
              (hash) value.<br>
              <br>
              I'm using it that way but there is some extra effort to
              customize and <br>
              maintain import/export plugins.<br>
              <br>
              If anybody have a suggestion or a better solution please
              let me know.<br>
              <br>
              Maybe this is a good opportunity to discuss that i18n
              issues in EPrints.<br>
              <br>
              Kind regards,<br>
              --<br>
              Alen<br>
              <br>
              On 06/24/2015 10:15 AM, George Mamalakis wrote:<br>
              &gt; Ah,<br>
              &gt;<br>
              &gt; And by the way, is there any documentation on this
              "fields" attribute <br>
              &gt; somewhere? Cos I think it wasn't mentioned anywhere.<br>
              &gt;<br>
              &gt; Thanks again!<br>
              &gt;<br>
              &gt; On 24/06/2015 10:29 πμ, Timothy Miles-Board wrote:<br>
              &gt;&gt;<br>
              &gt;&gt; ---------- Forwarded message ----------<br>
              &gt;&gt; From: Timothy Miles-Board <a
                moz-do-not-send="true" class="moz-txt-link-rfc2396E"
                href="mailto:timothy.miles-board@ulcc.ac.uk">
                &lt;timothy.miles-board@ulcc.ac.uk&gt;</a><br>
              &gt;&gt; Date: 18 Jun 2015 11:30 pm<br>
              &gt;&gt; Subject: Re: [EP-tech] How to set a field to be
              multilang<br>
              &gt;&gt; To: <a moz-do-not-send="true"
                class="moz-txt-link-abbreviated"
                href="mailto:eprints-tech@ecs.soton.ac.uk">
                eprints-tech@ecs.soton.ac.uk</a><br>
              &gt;&gt; Cc:<br>
              &gt;&gt;<br>
              &gt;&gt; {<br>
              &gt;&gt; name =&gt; 'title',<br>
              &gt;&gt; type =&gt; 'multilang',<br>
              &gt;&gt; multiple =&gt; 1,<br>
              &gt;&gt; fields =&gt; [ { sub_name =&gt; "text", type
              =&gt; "longtext",<br>
              &gt;&gt; input_rows =&gt; 3, make_single_value_orderkey
              =&gt;<br>
              &gt;&gt; 'EPrints::Extras::english_title_orderkey' } ],<br>
              &gt;&gt; input_add_boxes =&gt; 1,<br>
              &gt;&gt; },<br>
              &gt;&gt;<br>
              &gt;&gt;<br>
              &gt;&gt; Tim<br>
              &gt;&gt;<br>
              &gt;&gt; On 23 Jun 2015 9:09 am, George Mamalakis <a
                moz-do-not-send="true" class="moz-txt-link-rfc2396E"
                href="mailto:mamalos@eng.auth.gr">
                &lt;mamalos@eng.auth.gr&gt;</a> wrote:<br>
              &gt;&gt;<br>
              &gt;&gt; Guys (and girls),<br>
              &gt;&gt;<br>
              &gt;&gt; Any news on multilingual fields? Anybody using
              them?<br>
              &gt;&gt;<br>
              &gt;&gt; Thanks!<br>
              &gt;&gt;<br>
              &gt;&gt; George<br>
              &gt;&gt;<br>
              &gt;&gt; On 18/06/2015 06:31 μμ, George Mamalakis wrote:<br>
              &gt;&gt; &gt; Hello again,<br>
              &gt;&gt; &gt;<br>
              &gt;&gt; &gt; I am trying to make my EPrints installation
              support<br>
              &gt;&gt; multilanguage fields<br>
              &gt;&gt; &gt; (eg. title, abstract, etc.). The thing I did
              that worked (which<br>
              &gt;&gt; doesn't<br>
              &gt;&gt; &gt; feel right to me, though) was adding a new
              Metadata field (eg.<br>
              &gt;&gt; title_en)<br>
              &gt;&gt; &gt; and add it to the database and workflow. On
              the documentation,<br>
              &gt;&gt; on the<br>
              &gt;&gt; &gt; other hand, I saw that there is a Multilang
              field type<br>
              &gt;&gt; &gt; (./perl_lib/EPrints/MetaField/<a
                moz-do-not-send="true" href="http://Multilang.pm">Multilang.pm</a>)
              which should be<br>
              &gt;&gt; used for<br>
              &gt;&gt; &gt; this purpose. The strange thing is that its
              perldoc DESCRIPTION<br>
              &gt;&gt; section<br>
              &gt;&gt; &gt; starts with "not done", probably meaning
              that it's not implemented?<br>
              &gt;&gt; &gt; Disregarding the last comment, when I
              changed<br>
              &gt;&gt; &gt; ./archives/myarchive/cfg/cfg.d/eprint_<a
                moz-do-not-send="true" href="http://fields.pl">fields.pl</a>
              title field to<br>
              &gt;&gt; read:<br>
              &gt;&gt; &gt;<br>
              &gt;&gt; &gt; {<br>
              &gt;&gt; &gt; name =&gt; 'title',<br>
              &gt;&gt; &gt; type =&gt; 'multilang',<br>
              &gt;&gt; &gt; input_rows =&gt; 3,<br>
              &gt;&gt; &gt; make_single_value_orderkey =&gt;<br>
              &gt;&gt; &gt; 'EPrints::Extras::english_title_orderkey',<br>
              &gt;&gt; &gt; },<br>
              &gt;&gt; &gt;<br>
              &gt;&gt; &gt; and I reloaded epadmin, I got the following
              error:<br>
              &gt;&gt; &gt;<br>
              &gt;&gt; &gt; "Error in field property for eprint.title:
              fields on a multilang<br>
              &gt;&gt; &gt; metafield can't be undefined"<br>
              &gt;&gt; &gt;<br>
              &gt;&gt; &gt; So, which is the proper way for adding
              multilanguage support in<br>
              &gt;&gt; fields<br>
              &gt;&gt; &gt; and display them in workflows?<br>
              &gt;&gt; &gt;<br>
              &gt;&gt; &gt; Thanks for all help in advance!<br>
              &gt;&gt; &gt;<br>
              &gt;&gt;<br>
              &gt;&gt;<br>
              &gt;&gt; -- <br>
              &gt;&gt; George Mamalakis<br>
              &gt;&gt;<br>
              &gt;&gt; IT and Security Officer,<br>
              &gt;&gt; Electrical and Computer Engineer (Aristotle Univ.
              of Thessaloniki),<br>
              &gt;&gt; PhD (Aristotle Univ. of Thessaloniki),<br>
              &gt;&gt; MSc (Imperial College of London)<br>
              &gt;&gt;<br>
              &gt;&gt; School of Electrical and Computer Engineering<br>
              &gt;&gt; Aristotle University of Thessaloniki<br>
              &gt;&gt;<br>
              &gt;&gt; phone number : +30 (2310) 994379<br>
              &gt;&gt;<br>
              &gt;&gt;<br>
              &gt;&gt;<br>
              &gt;&gt; *** Options:<br>
              &gt;&gt; <a moz-do-not-send="true"
                href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech">http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech</a><br>
              &gt;&gt; *** Archive: <a moz-do-not-send="true"
                href="http://www.eprints.org/tech.php">http://www.eprints.org/tech.php</a>/<br>
              &gt;&gt; *** EPrints community wiki: <a
                moz-do-not-send="true" href="http://wiki.eprints.org">http://wiki.eprints.org</a>/<br>
              &gt;&gt; *** EPrints developers Forum: <a
                moz-do-not-send="true" href="http://forum.eprints.org">http://forum.eprints.org</a>/<br>
              &gt;&gt;<br>
              &gt;&gt;<br>
              &gt;&gt;<br>
              &gt;&gt; *** Options:<a moz-do-not-send="true"
                href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech">http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech</a><br>
              &gt;&gt; *** Archive:<a moz-do-not-send="true"
                href="http://www.eprints.org/tech.php">http://www.eprints.org/tech.php</a>/<br>
              &gt;&gt; *** EPrints community wiki:<a
                moz-do-not-send="true" href="http://wiki.eprints.org">http://wiki.eprints.org</a>/<br>
              &gt;&gt; *** EPrints developers Forum:<a
                moz-do-not-send="true" href="http://forum.eprints.org">http://forum.eprints.org</a>/<br>
              &gt;<br>
              &gt;<br>
              &gt; -- <br>
              &gt; George Mamalakis<br>
              &gt;<br>
              &gt; IT and Security Officer,<br>
              &gt; Electrical and Computer Engineer (Aristotle Univ. of
              Thessaloniki),<br>
              &gt; PhD (Aristotle Univ. of Thessaloniki),<br>
              &gt; MSc (Imperial College of London)<br>
              &gt;<br>
              &gt; School of Electrical and Computer Engineering<br>
              &gt; Aristotle University of Thessaloniki<br>
              &gt;<br>
              &gt; phone number : +30 (2310) 994379<br>
              &gt;<br>
              &gt;<br>
              &gt;<br>
              &gt;<br>
              &gt; ----------------------------- Upozorenje
              -----------------------------<br>
              &gt;<br>
              &gt; Automatskom detekcijom utvrdjeno je da tekst ove
              poruke<br>
              &gt; podsjeca na tzv. phishing poruku.<br>
              &gt;<br>
              &gt; AKO SE U PORUCI TRAZI DA POSALJETE VASU IRB LOZINKU
              ILI<br>
              &gt; DA UNESETE IRB PODATKE NA NAVEDENOM LINKU, RADI SE O<br>
              &gt; NAPADU S CILJEM KRADJE I ZLOUPOTREBE PODATAKA.<br>
              &gt;<br>
              &gt; Centar za informatiku i racunarstvo,<br>
              &gt; Institut Rudjer Boskovic<br>
              &gt;<br>
              &gt; ----------------------------- Upozorenje
              -----------------------------<br>
              &gt;<br>
              &gt;<br>
              &gt; *** Options: <a moz-do-not-send="true"
                href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech">
http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech</a><br>
              &gt; *** Archive: <a moz-do-not-send="true"
                href="http://www.eprints.org/tech.php">http://www.eprints.org/tech.php</a>/<br>
              &gt; *** EPrints community wiki: <a
                moz-do-not-send="true" href="http://wiki.eprints.org">http://wiki.eprints.org</a>/<br>
              &gt; *** EPrints developers Forum: <a
                moz-do-not-send="true" href="http://forum.eprints.org">http://forum.eprints.org</a>/<br>
              <br>
              <br>
              -- <br>
              Sent from my Android device with K-9 Mail. Please excuse
              my brevity. <br>
              <fieldset class="mimeAttachmentHeader"></fieldset>
              <br>
              <pre>*** Options: <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech">http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech</a>
*** Archive: <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.eprints.org/tech.php/">http://www.eprints.org/tech.php/</a>
*** EPrints community wiki: <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://wiki.eprints.org/">http://wiki.eprints.org/</a>
*** EPrints developers Forum: <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://forum.eprints.org/">http://forum.eprints.org/</a>
</pre>
            </blockquote>
            <br>
            <br>
            <pre class="moz-signature" cols="72">-- 
George Mamalakis

IT and Security Officer, 
Electrical and Computer Engineer (Aristotle Univ. of Thessaloniki),
PhD (Aristotle Univ. of Thessaloniki),
MSc (Imperial College of London)

School of Electrical and Computer Engineering
Aristotle University of Thessaloniki

phone number : +30 (2310) 994379


</pre>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">*** Options: <a class="moz-txt-link-freetext" href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech">http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech</a>
*** Archive: <a class="moz-txt-link-freetext" href="http://www.eprints.org/tech.php/">http://www.eprints.org/tech.php/</a>
*** EPrints community wiki: <a class="moz-txt-link-freetext" href="http://wiki.eprints.org/">http://wiki.eprints.org/</a>
*** EPrints developers Forum: <a class="moz-txt-link-freetext" href="http://forum.eprints.org/">http://forum.eprints.org/</a>
</pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
George Mamalakis

IT and Security Officer, 
Electrical and Computer Engineer (Aristotle Univ. of Thessaloniki),
PhD (Aristotle Univ. of Thessaloniki),
MSc (Imperial College of London)

School of Electrical and Computer Engineering
Aristotle University of Thessaloniki

phone number : +30 (2310) 994379


</pre>
  </body>
</html>