cms-dev / cms-dev/cms

i18n space problem of consecutive {% trans %} blocks

Open
#1,549 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1k
Forks
412
Avg merge
6d 10h
Merged PRs (30d)
3

Description

In some languages (like zh_TW) we don't put spaces after periods, commas or between sentences. For example, 你好,世界。歡迎! is correct but 你好, 世界。 歡迎! is not.

It seems that some of CMS's i18n glues two sentences with a space, like:
https://github.com/cms-dev/cms/blob/821fed553d419ef437bc00c208562a25ae060c1b/cms/server/contest/templates/overview.html#L84-L85

or
https://github.com/cms-dev/cms/blob/821fed553d419ef437bc00c208562a25ae060c1b/cms/server/contest/templates/overview.html#L99-L100

And it feels awkward to see those half-width space between two sentences in the translated pages.

Relevant codes:
c71b2959025d8bd7581431b25dc43a586fad7bdb
https://github.com/cms-dev/cms/blob/821fed553d419ef437bc00c208562a25ae060c1b/cms/server/contest/formatting.py#L83
https://github.com/cms-dev/cms/blob/821fed553d419ef437bc00c208562a25ae060c1b/cms/server/contest/formatting.py#L103

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the cited consecutive translation blocks in cms/server/contest/templates/overview.html and the related logic in cms/server/contest/formatting.py. Reproduce the rendered output for zh_TW and compare it with a language that uses spaces. Done means adjacent translated sentences no longer gain unwanted half-width spaces while spacing remains correct for languages that need it.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
internationalization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.