Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] i18n: Translate arabic strings using Google cloud translate. #19069

Closed
wants to merge 1 commit into from

Conversation

hackerkid
Copy link
Member

@hackerkid hackerkid commented Jun 30, 2021

The PR contains only the frontend translations. This was translated using json-autotranslate NPM package which make use of Google Cloud Translate API. They have a generous free tier so this was all in the free plan(500k chars free per month). I think this covers running the script a couple more times. After that we might get charged. Can't seem to see the eaxct charcter usage in dashboard. But the pricing is not that high anyway.

  • Some of the variable names seems to have also been translated which is something we should fix before merging this.

  • I haven't gone through the translations properly. So there might be other issues as well.

@hackerkid
Copy link
Member Author

hackerkid commented Jul 1, 2021

I wrote a script to see how many strings have the variable names couurputed. Looks like 17/55 strings with with variable names got their variable corrupted during the translation.

https://gist.github.com/hackerkid/b51e153cc8b2e3176a350b21dc4f15e6

I opened an issue in upstream to see if they have any idea on how to deal wiith this
leolabs/json-autotranslate#51

As a temporary fix, I have removed the translation of the 14/17 corrupted translated strings and fixed the 3 remaining ones manually.

These are the ones I corrected manually. The change I made was to replace __ Stream__ with __ stream__

You are not subscribed to stream __stream__
أنت غير مشترك في البث __ Stream__

You subscribed to stream __stream__
لقد اشتركت في البث __ Stream__

You unsubscribed from stream __stream__
لقد ألغيت اشتراكك في تيار __ Stream__

@hackerkid
Copy link
Member Author

Oops. I just realized the locale/en/translations.json file I have been using as the template was of the outdated format. That is it uses __variable__ format for variables instead of {variable}. The migration was made in ae86ae9

Just ran the script with the the newer format and pushed to master. So the issue mentioned above is no longer present. But let me update my script to see and run it again just to make sure that that there are other lines that are corrupt.

@hackerkid
Copy link
Member Author

Okay. Ran the script. There does not seems to be any issues with corrupted variables

zulip git:(autotranslate) ✗ python3 check_google_translations_v2.py
Strings with variable  92
Translated strings with variable corrupted 0

https://gist.github.com/hackerkid/7cecbc9b1119674f49103b80071f8c90

@hackerkid
Copy link
Member Author

I went through the translations(variables, escaping etc) to see if I can find any issues.

I found some issues which is detailed below. If the issue was easily fixable for me, I would just fix it directly. Else I removed the translation so that the human translator can translate the string manually.

Most of the time I found an issue, I also updated my translation verifier script so that it can check whether there are any other occurances of that issue.

Some of the /commands got translated. I am just going to remove those translations

{
"/dark (Toggle night mode)": "/ غامق (تبديل الوضع الليلي)",
"/day (Toggle day mode)": "/ يوم (تبديل وضع اليوم)",
"/fixed-width (Toggle fixed width mode)": "/ عرض ثابت (تبديل وضع العرض الثابت)",
"/fluid-width (Toggle fluid width mode)": "/ عرض السوائل (تبديل وضع عرض السوائل)",
"/light (Toggle day mode)": "/ ضوء (تبديل وضع النهار)",
"/me is excited (Display action text)": "/ أنا متحمس (عرض نص الإجراء)",
"/night (Toggle night mode)": "/ ليلاً (تبديل الوضع الليلي)",
"/poll Where should we go to lunch today? (Create a poll)": "/ استطلاع أين يجب أن نذهب لتناول الغداء اليوم؟ (إنشاء استطلاع)",
"/settings (Load settings menu)": "/ الإعدادات (تحميل قائمة الإعدادات)",
"/todo (Create a todo list)": "/ todo (إنشاء قائمة مهام)",
"Tip: You can also send \"/poll Some question\"": "نصيحة: يمكنك أيضًا إرسال \"/ استطلاع بعض الأسئلة\"",
}

Strings with <p> tags seems to have extra right to left direction styling in the translated tags. Only two strings are there like this. I have removed the styling. One of this string has another issue as well which is discussed later.

{
"<p>Stream will be announced in <b>#{notifications_stream}</b>.</p>": "<p style=\";text-align:right;direction:rtl\">سيتم الإعلان عن الدفق في <b># {notifications_stream}</b> .</p>",

"<p>The stream <b>{stream_name}</b> does not exist.</p><p>Manage your subscriptions <z-link>on your Streams page</z-link>.</p>": "<p style=\";text-align:right;direction:rtl\">الدفق <b>{stream_name}</b> غير موجود.</p><p style=\";text-align:right;direction:rtl\"> ادير مشاركاتك<z-link> على صفحة البث الخاصة بك</z-link> .</p>",
}

<z-link>, <z-email> has been preserved.

A shortcut seems to have translated

{
"Filter topics (t)": "مواضيع التصفية (ر)",
}

Variables of format #{variable} seems to have got courrupted. I have fixed the ones that were obvious and emptied the rest.

{
"<p>Stream will be announced in <b>#{notifications_stream}</b>.</p>": "<p style=\";text-align:right;direction:rtl\">سيتم الإعلان عن الدفق في <b># {notifications_stream}</b> .</p>",
"Change stream permissions for #{stream_name}": "تغيير أذونات البث لـ # {stream_name}",
"Message #{stream_name}": "الرسالة رقم {stream_name}",
"Message #{stream_name} > {topic_name}": "الرسالة رقم {stream_name} &gt; {topic_name}",
"{count} users are subscribed to #{title}": "{count} مستخدم مشترك في # {title}",
}

When a variable is inside () like this ({variable}), the translation seems to have extra spaces like this ( {variable} ). Fixed the issue manually

{
"Message {recipient_name} ({recipient_status})": "الرسالة {recipient_name} ( {recipient_status} )",
"{username} [said]({link_to_message}):": "{username} [قال] ( {link_to_message} ):",
"Check your email ({email}) to confirm the new address.": "تحقق من بريدك الإلكتروني ( {email} ) لتأكيد العنوان الجديد.",
"Drafts ({draft_count})": "مسودات ( {draft_count} )",
"Edited ({last_edit_timestr})": "محرر ( {last_edit_timestr} )",
}

An extra space was added between the variable &quot;. I have fixed that.

{
"Narrow to stream &quot;{display_recipient}&quot;": "ضيق للتدفق &quot; {display_recipient} &quot;",
"Narrow to stream &quot;{display_recipient}&quot;, topic &quot;{topic}&quot;": "ضيق للدفق &quot; {display_recipient} &quot; ، الموضوع &quot; {topic} &quot;",
}

Single quotes and double quotes were getting replaced with &quot; for the following. I just removed the translation altogather since I was not sure whether replacing &quot; with the unsescpaed version is the right thing to do in arabic. So let the translator take care of them.

{
"Alert word \"{word}\" added successfully!": "تمت إضافة كلمة التنبيه &quot; {word} &quot; بنجاح!",
"We've replaced the \"{originalHotkey}\" hotkey with \"{replacementHotkey}\" to make this common shortcut easier to trigger.": "لقد استبدلنا مفتاح التشغيل السريع &quot; {originalHotkey} {replacementHotkey} &quot; لتسهيل تشغيل هذا الاختصار الشائع.",
"Are you sure you want to create stream ''''{stream_name}'''' and subscribe {count} users to it?": "هل أنت متأكد أنك تريد إنشاء تيار &quot; ''{stream_name}'' &quot; واشتراك {count} فيه؟",
"Default is {language}. Use 'text' to disable highlighting.": "الافتراضي هو {language} . استخدم &quot;نص&quot; لتعطيل التمييز.",
}

@hackerkid
Copy link
Member Author

@timabbott I think at this point this PR should be ready for review from your side. I will also create a PR to include the script as well as documentation on how to generate these translations.

@zulipbot
Copy link
Member

zulipbot commented Sep 7, 2021

Heads up @hackerkid, we just merged some commits that conflict with the changes your made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the upstream/main branch and resolve your pull request's merge conflicts accordingly.

@hackerkid
Copy link
Member Author

Closing since this has became quite stale.

@hackerkid hackerkid closed this Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants