Closed chenejac closed 3 years ago
Nicolas B Dickn said:
Revised to "Major", but not to be treated before merging in June 2020 i18n sprint.
Andrew Woods said:
The issue here is that i18n functionality needs to be added to VisualizationCaches, specifically: https://github.com/vivo-project/VIVO/blob/master/api/src/main/java/edu/cornell/mannlib/vitro/webapp/visualization/utilities/VisualizationCaches.java#L230 ...and potentially the other static CachingRDFServiceExecutor instances in this class.
A naive resolution to this issue would be to make the following change:
--- a/api/src/main/java/edu/cornell/mannlib/vitro/webapp/visualization/utilities/VisualizationCaches.java
+++ b/api/src/main/java/edu/cornell/mannlib/vitro/webapp/visualization/utilities/VisualizationCaches.java
@@ -234,12 +234,20 @@ final public class VisualizationCaches {
new CachingRDFServiceExecutor.RDFServiceCallable<Map<String, String>>(visualizationAffinity) {
@Override
protected Map<String, String> callWithService(RDFService rdfService) throws Exception {
+ VitroRequest vreq = rdfService.getVitroRequest();
+ String langCtx = "en-US";
+ try {
+ langCtx = vreq.getLocale().getLanguage() + "-"+vreq.getLocale().getCountry();
+ } catch (Exception e) {
+ }
String query = QueryConstants.getSparqlPrefixQuery() +
"SELECT ?org ?orgLabel\n" +
"WHERE\n" +
"{\n" +
" ?org a foaf:Organization .\n" +
" ?org rdfs:label ?orgLabel .\n" +
+ " FILTER (lang(?orgLabel) = '" + langCtx + "' ) \n" +
"}\n";
final Map<String, String> map = new HashMap<>();
..as was done with: https://github.com/vivo-project/VIVO/commit/49e120f36e225d3469ba7cd527124cf1e6c056cc#diff-92c4e9fc96dcf4f65bdc2dac8135436aR396-R411
However, a more complete resolution should support fallback behavior to other languages, if the specific langTag is not found, such as what was done with: https://github.com/vivo-project/VIVO/commit/f32dea3628d8a0d8570ad9edead4ac15fe349816#diff-980302343660eb12edae2d88b10d55a0R168-R187
Dominik Feldschnieders said:
[PR|[https://github.com/vivo-project/VIVO/pull/192]]
I have implemented your suggested changes. Is this the only place where this should happen or also the other SPARQL queries with labels in the file?
Andrew Woods said:
Nice work!
Alexander J. Jerabek (Migrated from VIVO-1867) said:
For a person with a given domain, eg. Music in their profile and where the french version has the correct french version 'Musique', in the capability map, the domain appears in English.