element-web icon indicating copy to clipboard operation
element-web copied to clipboard

Custom translations: Some strings cannot be overwritten.

Open YamatoRyou opened this issue 7 months ago • 2 comments

Steps to reproduce

n/a

Outcome

What did you expect?

n/a

What happened instead?

This is a follow-up to #30051. I spent more than a week completely redoing the simplified Chinese translation of EW (I have switched to the correct language code zh-hans), and found that some strings still cannot be overwritten.

List:

  • Timeline -> Date jump options (need to enable "jump to date" in the lab): Last week, no corresponding key Last month, no corresponding key Image

  • Room Info -> Polls: Active polls, right_panel.poll.active_heading Past polls, right_panel.poll.past_heading Image

  • Settings -> Notifications (need to enable "Notification Settings (Beta)" in the lab): People, no corresponding key Image

  • Settings -> About: Privacy Policy, no corresponding key Cookie Policy, no corresponding key Image

  • Date and week on the timeline (i.e. those displayed with message history, This is a bit special: these have no corresponding key, but they are forced to use the official simplified Chinese translation, which makes it impossible for custom translations to adjust their format by forced overwriting) Image

In the above list:

  • "No corresponding key" means that these strings cannot be overwritten by custom translations, even if the language code is correct.
  • Even if some strings have a corresponding key, custom translations will not work for them.

Operating system

x64 Windows 11 (10.0.26100)

Browser information

Vivaldi 7.4.3684.38 (x64, Chromium 136)

URL for webapp

Element Web 1.11.104

Application version

No response

Homeserver

Synapse 1.132.0

Will you send logs?

No

YamatoRyou avatar Jun 18 '25 22:06 YamatoRyou

Timeline -> Date jump options (need to enable "jump to date" in the lab): Last week, no corresponding key Last month, no corresponding key

This is intentional, all time related strings are provided by the browser's Intl API. You can see how many strings we're able to save from translation using the Intl API:

  • https://github.com/element-hq/element-web/pull/26001/files
  • https://github.com/matrix-org/matrix-react-sdk/pull/11511/files#diff-20527b4ae184e85263f5a70fc00d1cb022b054ea126e404332da46983247e5bc
  • https://github.com/matrix-org/matrix-react-sdk/pull/11427/files
  • https://github.com/matrix-org/matrix-react-sdk/pull/11422/files#diff-20527b4ae184e85263f5a70fc00d1cb022b054ea126e404332da46983247e5bc

Room Info -> Polls: Active polls, right_panel.poll.active_heading Past polls, right_panel.poll.past_heading

Surely its right_panel|poll|active_heading etc

Settings -> Notifications (need to enable "Notification Settings (Beta)" in the lab): People, no corresponding key

Can confirm, this is a bug

Privacy Policy, no corresponding key Cookie Policy, no corresponding key

These texts come from the config.json terms_and_conditions_links, given they can be any text it isn't possible to map them to any i18n keys.

Date and week on the timeline (i.e. those displayed with message history, This is a bit special: these have no corresponding key, but they are forced to use the official simplified Chinese translation, which makes it impossible for custom translations to adjust their format by forced overwriting)

Again, uses browser Date APIs, using the correct API, we're not wanting to have to add support for custom Date expressions as they can be rather complex and errorprone.

t3chguy avatar Jun 19 '25 07:06 t3chguy

Timeline -> Date jump options (need to enable "jump to date" in the lab): Last week, no corresponding key Last month, no corresponding key

This is intentional, all time related strings are provided by the browser's Intl API. You can see how many strings we're able to save from translation using the Intl API:

  • https://github.com/element-hq/element-web/pull/26001/files
  • https://github.com/matrix-org/matrix-react-sdk/pull/11511/files#diff-20527b4ae184e85263f5a70fc00d1cb022b054ea126e404332da46983247e5bc
  • https://github.com/matrix-org/matrix-react-sdk/pull/11427/files
  • https://github.com/matrix-org/matrix-react-sdk/pull/11422/files#diff-20527b4ae184e85263f5a70fc00d1cb022b054ea126e404332da46983247e5bc

Room Info -> Polls: Active polls, right_panel.poll.active_heading Past polls, right_panel.poll.past_heading

Surely its right_panel|poll|active_heading etc

Settings -> Notifications (need to enable "Notification Settings (Beta)" in the lab): People, no corresponding key

Can confirm, this is a bug

Privacy Policy, no corresponding key Cookie Policy, no corresponding key

These texts come from the config.json terms_and_conditions_links, given they can be any text it isn't possible to map them to any i18n keys.

Date and week on the timeline (i.e. those displayed with message history, This is a bit special: these have no corresponding key, but they are forced to use the official simplified Chinese translation, which makes it impossible for custom translations to adjust their format by forced overwriting)

Again, uses browser Date APIs, using the correct API, we're not wanting to have to add support for custom Date expressions as they can be rather complex and errorprone.


  • Room Info -> Polls: Active polls, right_panel.poll.active_heading Past polls, right_panel.poll.past_heading

https://github.com/YamatoRyou/element-web-custom-translation-simplified-chinese/blob/94c120e457c436beb7488d7d73afc5cd3ee92ea9/ew_tr_zh_Hans.json#L1676 https://github.com/YamatoRyou/element-web-custom-translation-simplified-chinese/blob/94c120e457c436beb7488d7d73afc5cd3ee92ea9/ew_tr_zh_Hans.json#L1689 In custom translations, these keys still use the pipe-delimited format. I have confirmed this. As for the other strings that cannot be overwritten, I already know that this is the result of various trade-offs.👌

YamatoRyou avatar Jun 19 '25 14:06 YamatoRyou

Timeline -> Date jump options (need to enable "jump to date" in the lab): Last week, no corresponding key Last month, no corresponding key

This is intentional, all time related strings are provided by the browser's Intl API. You can see how many strings we're able to save from translation using the Intl API:

  • https://github.com/element-hq/element-web/pull/26001/files
  • https://github.com/matrix-org/matrix-react-sdk/pull/11511/files#diff-20527b4ae184e85263f5a70fc00d1cb022b054ea126e404332da46983247e5bc
  • https://github.com/matrix-org/matrix-react-sdk/pull/11427/files
  • https://github.com/matrix-org/matrix-react-sdk/pull/11422/files#diff-20527b4ae184e85263f5a70fc00d1cb022b054ea126e404332da46983247e5bc

Room Info -> Polls: Active polls, right_panel.poll.active_heading Past polls, right_panel.poll.past_heading

Surely its right_panel|poll|active_heading etc

Settings -> Notifications (need to enable "Notification Settings (Beta)" in the lab): People, no corresponding key

Can confirm, this is a bug

Privacy Policy, no corresponding key Cookie Policy, no corresponding key

These texts come from the config.json terms_and_conditions_links, given they can be any text it isn't possible to map them to any i18n keys.

Date and week on the timeline (i.e. those displayed with message history, This is a bit special: these have no corresponding key, but they are forced to use the official simplified Chinese translation, which makes it impossible for custom translations to adjust their format by forced overwriting)

Again, uses browser Date APIs, using the correct API, we're not wanting to have to add support for custom Date expressions as they can be rather complex and errorprone.

I just discovered that the hint of a button cannot be overwritten by custom translation. Settings -> Session -> Show QR code Based on the words displayed, the possible corresponding key is: action|back Image

YamatoRyou avatar Jun 29 '25 20:06 YamatoRyou

@YamatoRyou With last two PRs, the polls and the back button of QR Code has been fixed. All the points of the issue has been addressed.

Can you confirm it?

florianduros avatar Jul 24 '25 17:07 florianduros

@YamatoRyou With last two PRs, the polls and the back button of QR Code has been fixed. All the points of the issue has been addressed.

Can you confirm it?

I tested by pulling the Docker image (tag: develop) and found that these strings have been fixed.

Image Image

YamatoRyou avatar Jul 24 '25 20:07 YamatoRyou