control-panel-for-twitter icon indicating copy to clipboard operation
control-panel-for-twitter copied to clipboard

Replace "Using X since YYYY/MM" with "Using Twitter since YYYY/MM" in Japanese UI

Open tohu-sand opened this issue 10 months ago • 1 comments

In the Japanese version of the web interface, the home screen displays the text "YYYY年MM月からXを利用しています" (meaning "Using X since YYYY/MM").

It would be great if this could be replaced with "YYYY年MM月からTwitterを利用しています" to maintain consistency with the branding restoration features.

Thank you for your consideration!

Image

tohu-sand avatar Jan 30 '25 01:01 tohu-sand

This is similar to #391 in that to support all languages we need to do this based on Twitter's translation data for each locale.

For this particular string, the locale data id is cf249089 and "X" is only referenced in certain languages, e.g.:

ja: ("cf249089",(function(e){return e.joinDate+"からXを利用しています"})) en: ("cf249089",(function(e){return"Joined "+e.joinDate}))

If we create a RegExp based on the original version to extract the input, we should be able to plug it into a version of the translated string with X replaced:

let joinDateRE = new RegExp('^(?<joinDate>.+)からXを利用しています$')
let replacement = '$1からTwitterを利用しています'
let $joinDate = document.querySelector('[data-testid="UserJoinDate"]')
$joinDate.textContent = $joinDate.textContent.replace(joinDateRE, replacement)

To support this we need to update create-locales.js to create the appropriate RegExp and replacement string for languages which have a term we want to replace in them.

insin avatar Feb 24 '25 03:02 insin