rism-digital / muscat

🗂️ A Rails application for the inventory of handwritten and printed music scores
http://muscat-project.org
34 stars 16 forks source link

Cannot edit marc records if a translated element contains an apostrophe (') #1360

Closed fjorba closed 1 year ago

fjorba commented 1 year ago

We could not edit secondary literature marc records when locale was set to Catalan. After several debugging sessions, the error happens to be that one of the translated elements has an apostrophe. According to Firefox debug messages:

Uncaught Error: Syntax error, unrecognized expression: a[data-scroll-target='Camps_d'accés_de_matèria'] jQuery 7 _marc_validate_unhighlight marc_editor_validation.source.js:135 unhighlight marc_editor_validation.source.js:431

data-scroll-target should enclose the element.

ahankinson commented 1 year ago

You were wondering about what weird bugs might pop up with unexpected characters in the translations.... :-D

fjorba commented 1 year ago

Indeed. But the apostrophe is not really an exotic character, like others that exist in the current Muscat translation languages. Even plain English has it.

ahankinson commented 1 year ago

Yes, but if a simple apostrophe can break things, imagine what an unexpected unicode character can do!

(To be clear: I'm not asking you to change the unicode character, just that we should definitely keep an eye on the translations as a possible source of problems if we do spot something like this...)

xhero commented 1 year ago

Are you saying we should handle this better in Muscat? :-P @fjorba thanks for the PR, I will merge, I will also make a ticket to find a more permanent solution.

fjorba commented 1 year ago

I trust Rails (as so other modern platforms, languages and tools) that now those internationalization issues are properly solved.

But wait when the first language in a non Latin alphabet enters Muscat. Will Javascript handle a target in alphabets other than Latin?

ahankinson commented 1 year ago

🤷

BaMikusi commented 1 year ago

I don't know if it's relevant to this particular discussion but we do already have a bunch of records e.g. with Korean characters, see for instance https://muscat.rism.info/admin/sources/1001139365

fjorba commented 1 year ago

In that particular case only affects the translation of the Muscat user interface (if a translated text of a section had a apostroph), but yes, sure than each writing system poses a particular challenge to all applications.

And then, how illiterate do we feel when not even the writing system we can understand!