internetarchive / internetarchive/openlibrary

Edition number is shown in wrong location in author merge interface when Work title is a right‐to‐left language

Open
#10,115 8 comments 0 reactions 0 assignees View on GitHub
Lead: @cdrini Priority: 4 Theme: Internationalization (i18n) Type: Bug
Dominant language
Python
Stars
6.7k
Forks
2k
Avg merge
2d 19h
Merged PRs (30d)
138

Description

### Problem

When merging authors, the merge interface shows a handful of works by each author in the merge, along with edition counts and earliest years of publication. If the Work title is written in a right‐to‐left language (e.g., Arabic) but the interface is a left‐to‐right language (e.g., English), the number of editions get included in the rtl part before the text switches back to ltr.

![e.g., “مدرسة العذاب 1 edition, 2009”](https://github.com/user-attachments/assets/b74ace2c-9516-4b7f-ac07-5f15be161012)

### Reproducing the bug

1. Go to https://openlibrary.org/authors/merge?key=OL5077340A&key=OL11487744A (or another author merge where at least one work has a title in a rtl language)

* Expected behavior: edition count and year, e.g. “1 edition, 2009”, being shown at one end (to the left or to the right, dependent on language direction) and the title, e.g. “مدرسة العذاب”, at the other.
* Actual behavior: The edition count gets shown mixed in with the rtl language (e.g., “مدرسة العذاب 1”) while the edition stands on it own with release year and no count (e.g., “edition, 2009”).

### Context

- Browser (Chrome, Safari, Firefox, etc): Firefox 133.0
- OS (Windows, Mac, etc): Linux (Arch, btw)
- Logged in (Y/N): Y
- Environment (prod, dev, local): prod

### Breakdown

#### Ponderings

This can be fixed by explicitly marking the `` that holds the edition count and year with a `dir="ltr"`. However, this should obviously only be done for ltr languages, so this needs to be dependent on what interface language is currently being used. (Not sure if we currently support any non‐ltr languages, but that might come at some point in the future, so the fix for this should not make assumptions based on currently supported locales.)

#### Requirements Checklist
* [ ]

#### Related files

*

#### Stakeholders

*


#### Instructions for Contributors

- Please [run these commands](https://github.com/internetarchive/openlibrary/wiki/Git-Cheat-Sheet#working-on-your-branch) to ensure your repository is up to date **before** [creating a new branch](https://github.com/internetarchive/openlibrary/wiki/Git-Cheat-Sheet#making-changes-and-creating-a-pull-request) to work on this issue and **each time after** pushing code to Github, because the pre-commit bot may add commits to your PRs upstream.

Contributor guide

Open the contributing guide

Research direction

Open the author merge interface at the reproduction URL and reproduce the issue with a right-to-left work title in an English interface. Inspect the markup around the edition count and year, especially the span containing them, and verify the display in both text directions. Done means the title remains separated from the edition count and year, with their ordering following the interface language.

Written by the indexing model from the issue text.

Assessment

Domain
frontend, internationalization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.