relaton / relaton-bib

MIT License
3 stars 1 forks source link

Trim XML data by language #31

Closed andrew2net closed 4 years ago

andrew2net commented 4 years ago

To solve this issue https://github.com/metanorma/metanorma-iso/issues/417#issuecomment-702239754 it needs to add :lang option to .to_xml method. So calling .to_xml(lang: "fr") trims all non French language tagged strings from XML.

opoudjis commented 4 years ago

Does not seem to be filtering out "en" titles if "fr" requested, is doing both. I am using .fetch(lang: "fr"), don't know if that makes a difference.

andrew2net commented 4 years ago

When we fetch ISO we have to get "en" page in any case, because we need to get the links to pages in other languages from the page. So if you fetch "fr" you get "en" and "fr". The fetch method returns BibliographicItem instance which contains all fetched languages. You need use ".to_xml(:lang => "fr")" to get filtered XML