geonetwork / core-geonetwork

GeoNetwork is a catalog application to manage spatially referenced resources. It provides powerful metadata editing and search functions as well as an interactive web map viewer. It is currently used in numerous Spatial Data Infrastructure initiatives across the world.
http://geonetwork-opensource.org/
GNU General Public License v2.0
410 stars 486 forks source link

Multilingual edit issues #1496

Open josegar74 opened 8 years ago

josegar74 commented 8 years ago

Attached metadata has some issues in metadata editor:

INSPIRE_Buildings_Service.txt

1) Language codes are changed from 3 iso letters to 2 iso letters. Not sure if this is a good behaviour, I guess should be not changed or at least clear which language codes should be used.

2) When switching to xml view and getting back to Default view, in the keywords appear some null entries

This looks related to 1) as all elements are changed to 2 iso letters, except the keywords that preserve the 3 iso letters, causing these null entries in the editor.

Before switching to XML view:

1_before_xml

After switching to XML view:

3_after_xml

josegar74 commented 8 years ago

@fxprunayre Do you know about this behaviour?

a) Any idea why all elements except keywords language codes are changed to 2 iso letters?

b) Should be indicated to users to use only 2 iso letter codes for languages?

josegar74 commented 8 years ago

About a) probably is related to

https://github.com/geonetwork/core-geonetwork/blob/3.0.x/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl#L435-L437

doing a copy instead apply-templates, preventing to execute this template that is changing the language codes to 2 letters:

https://github.com/geonetwork/core-geonetwork/blob/3.0.x/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl#L340

fxprunayre commented 8 years ago

@fxprunayre Do you know about this behaviour?

Not really, was mainly done for geocat.ch.

a) Any idea why all elements except keywords language codes are changed to 2 iso letters?

I think locale codes should be preserved if existing (as they're no rules that the locale identifier is 2 letter code).

josegar74 commented 8 years ago

Ok, I removed the usage of java:twoCharLangCode in:

https://github.com/geonetwork/core-geonetwork/blob/develop/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl#L320

https://github.com/geonetwork/core-geonetwork/blob/develop/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl#L341

And that seem preserving fine the existing values, will check a bit more with my customer and if all looks fine, will commit it.

fxprunayre commented 8 years ago

We also probably need dedicated controls in the editor to properly add and remove a language (cf. #1488).

josegar74 commented 8 years ago

Ok, but that can be managed separately I guess.

Does it sound fine to commit the change to remove the usage java:twoCharLangCode in update-fixed-info.xsl?:

https://github.com/geonetwork/core-geonetwork/blob/develop/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl#L320

https://github.com/geonetwork/core-geonetwork/blob/develop/schemas/iso19139/src/main/plugin/iso19139/update-fixed-info.xsl#L341

fxprunayre commented 8 years ago

Any test branch where we can test it ? I think this will introduce issues with keyword selection which is not aware of the mapping between lang code and locale ids.

eg. view-source:http://localhost:8080/geonetwork/srv/eng/thesaurus.keyword?thesaurus=external.place.regions&id=http:%2F%2Fwww.naturalearthdata.com%2Fne_admin%23Country%2FALB&multiple=true&transformation=to-iso19139-keyword&lang=eng,fre,ger,chi,ara,spa,rus,aar&textgroupOnly=false

So at least some work required here to pass a map of value for the lang parameter here.

Then for associated resources, it looks like lang ids are passed in parameters http://localhost:8080/geonetwork/srv/api/records/2172/processes/onlinesrc-add?url=http:%2F%2Flemonde.fr&protocol=&name=eng%23englis%7CFR%23francais&desc=&function=information&applicationProfile=app%20profile&process=onlinesrc-add&id=2172 so it may be fine for that.

josegar74 commented 7 years ago

@fxprunayre See branch with the fix. It's based on 3.0.x, but I plan to do a merge to 3.2.x soon of that branch. If you have time, please check about this fix.

josegar74 commented 7 years ago

@fxprunayre, any chance to test this?

fxprunayre commented 7 years ago

@fxprunayre, any chance to test this?

It will not work if you don't change all places which assumes locale IDs are 2 letters upper case code eg.

josegar74 commented 7 years ago

So what to do:

1) Do you think should be changed all references to java:twoCharLangCode and seem also some js code to keep the original ids?

2) Or should be better to add some xslt process to "fix" the metadata to use 2 iso letter codes?

The problem about the option 2) is that I'm not sure that will work, as seem some mixup between the UI language code (3 letters) and the metadata locales as described initially. Also not sure if it's nice to change the metadata from the users.