Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way to display labels in multiple languages #170

Open
ghost opened this issue Aug 17, 2018 · 2 comments
Open

No way to display labels in multiple languages #170

ghost opened this issue Aug 17, 2018 · 2 comments

Comments

@ghost
Copy link

ghost commented Aug 17, 2018

There seems to be no way to give labels in multiple languages. It's a problem when the underlying vocabulary is a skos vocabulary where preflabels have langtags. We can not adapt the display to the user's language preferences. Or, should we create a yaml file per language with a suffix and adapt the client code? Or replace the terms with i18n keys and put the labels in the internationalization files by adapting the code?

@elrayle
Copy link
Contributor

elrayle commented Jan 22, 2019

@j-dornbusch I'm wondering if you can expand on the issue you are having with an example of a label that is not translating.

Here are a few observations around language processing in QA.

  • I don't believe QA has any application level labels unless you count the prefixes in the normalized json that are returned in the results (e.g. id:, label:, etc.)
  • I don't believe any of the non-linked data modules handle requests for a specific language, but I haven't fully checked all of those.
  • For linked data, some of the authorities support the addition of a lang=de parameter to the request URL which will return any literals tagged with de and any literals without a language tag. Authorities themselves have variable support for languages and QA is not able to rectify a lack of support in the data.

Authority language data comes in several varieties:

authority defines literals with language tags for a single label predicate

This allows for a search with the query string in the specified language and returns results in the requested language

Examples:

https://lookup.ld4l.org/authorities/search/linked_data/agrovoc_ld4l_cache?q=Milch&maxRecords=4&lang=de

https://lookup.ld4l.org/authorities/search/linked_data/getty_aat_ld4l_cache?q=karte&maxRecords=4&lang=de

authority defines alternate language literals in alternate label

This allows for a search with the query string in the specified language, but the results will be returned for the primary language only (almost always English)

Example:

https://lookup.ld4l.org/authorities/search/linked_data/oclcfast_ld4l_cache?q=twain%20marek&maxRecords=4

authority defines language variants linked via a bnode

QA can search other direct predicates (as seen in previous example), but does not at this time support cascading search to a bnode value. In this case, you cannot search using a query string in the alternate language. It will return 0 results.

<http://id.loc.gov/authorities/subjects/sh85118553> <http://www.loc.gov/mads/rdf/v1#hasCloseExternalAuthority> <http://d-nb.info/gnd/4066562-8> . 
<http://d-nb.info/gnd/4066562-8> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.loc.gov/mads/rdf/v1#Authority> . 
<http://d-nb.info/gnd/4066562-8> <http://www.loc.gov/mads/rdf/v1#authoritativeLabel> "Wissenschaft"@de . 

authority defines language variants linked via a bnode and marked with the wrong language tag

http://id.loc.gov/authorities/names/n79021164.nt

authority has no language support

There are more than a few authorities where the raw data does not include language tags on the literals.

A few other thoughts

If you have a specific authority you are trying to work with, we can look into what the data supports and whether an indexing change would allow for language search.

QA can support many more authorities than what comes with QA. Many of the examples here are from these additional authorities. You can see other supported linked data authorities at https://github.com/ld4p/linked_data_authorities.

@ghost
Copy link
Author

ghost commented Sep 2, 2019

@elrayle I am sorry to answer after such a long delay.
We have created file based controlled vocabularies derived from Skos thesaurus. So the 'prefLabels' come with RDF langtags. The generated YAML file looks like this :

terms:
  - id: http://data.ehess.fr/thes/airecult/aire8
    term:
      - '"Asie"@fr'
      - '"Asia"@en'
  - id: http://data.ehess.fr/thes/airecult/aire13
    term:
      - '"Britanniques (études)"@fr'
      - '"British (studies)"@fr'
  - id: http://data.ehess.fr/thes/airecult/aire26
    term:
      - '"Japon"@fr'
      - '"Japan"@en'
  - id: http://data.ehess.fr/thes/airecult/aire2
    term:
      - '"Allemandes (études)"@fr'
      - '"German (studies)"@en'
  - id: http://data.ehess.fr/thes/airecult/aire20
    term:
      - '"Europe sud-orientale"@fr'
# etc

A wrapper service is then needed to filter the appropriate language (and of course a helper or a renderer to remove the langtag before displaying the label).

def select_all_options(locale = :fr)
    get_authority.all.map do |element|
      [apply_language_preference(element[:label], locale), element[:id]]
    end.sort_by {|element| element.first.downcase}
end

def get_authority
    authority = Qa::Authorities::Local.subauthority_for(@vocabulary_identifier) unless authority
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant