Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion apps/desktop/gt.config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"defaultLocale": "en",
"locales": ["de", "es", "fr", "ja", "ko", "pt-BR", "ru", "sv", "zh"],
"locales": ["ar", "de", "es", "fr", "ja", "ko", "pt-BR", "ru", "sv", "zh"],
"src": ["src/**/*.ts", "!**/*.test.ts"],
"files": {
"gt": {
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/i18n/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const DEFAULT_LOCALE = "en";

// English is the source text and loads nothing. Keep the keys in step with gt.config.json.
const CATALOGS: Readonly<Record<string, () => Promise<{ readonly default: Catalog }>>> = {
ar: () => import("./translations/ar.json", { with: { type: "json" } }),
de: () => import("./translations/de.json", { with: { type: "json" } }),
es: () => import("./translations/es.json", { with: { type: "json" } }),
fr: () => import("./translations/fr.json", { with: { type: "json" } }),
Expand Down
127 changes: 127 additions & 0 deletions apps/desktop/src/i18n/translations/ar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
{
"743bb98558dcdddf": "تعذّر بدء T3 Code",
"45e444e807bececb": "مجلد T3 الرئيسي غير متاح",
"97665653aa9129ad": "جارٍ البحث عن إصدار أحدث…",
"dce25e68e60eb512": "الإصدار {version} متاح وقد يتضمن إصلاحًا للمشكلة.",
"2f015e6d5459dce9": "التحديث إلى {version}",
"ca9838012a0eb084": "جارٍ تنزيل {version}. سيُعاد تشغيل T3 Code عند اكتمال التنزيل.",
"c38cbed9acc5b0d1": "جارٍ تنزيل {version} ({percent}%). سيُعاد تشغيل T3 Code عند اكتمال التنزيل.",
"4b4cf6843a4e0aba": "سبق أن بدأ الإصدار {version} بنجاح على هذا الحاسوب. نزّله وثبّته للرجوع إليه.",
"b57c6134d74c0848": "تنزيل {version}",
"1eeed583c2254507": "احصل على إصدار آخر من صفحة الإصدارات.",
"4cd5b64eeb26e1ee": "فتح صفحة الإصدارات",
"7e21da2485a8e0bb": "منعت سياسة مؤسستك بدء تشغيل T3 Code. أرسل التفاصيل أدناه إلى مسؤول تقنية المعلومات.",
"55a19ca527948aaa": "تعذّر بدء T3 Code",
"4825d2a18a5fc093": "نسخ التفاصيل",
"3874c9f538653a6d": "إنهاء",
"0eec8b51246f5e2c": "لم يُصدر الخادم أي مخرجات.",
"6cb1b68bddf39b35": "الإصدار {version}. يعيد T3 Code المحاولة في الخلفية. السجلات: {logDir}",
"895f988b9de16f88": "لا تزال خدمة WSL الخلفية غير متاحة",
"eeb7ea62dc4706c1": "سيستخدم T3 Code خدمة Windows الخلفية هذه المرة وسيحاول تشغيل WSL مجددًا عند بدء التطبيق في المرة القادمة.",
"b5435aa5b470bafd": "تعذّر بدء خدمة WSL الخلفية",
"d82d7c96e1904629": "جارٍ استخدام خدمة Windows الخلفية ليتمكن T3 Code من الفتح. بعد إصلاح توزيعة WSL، أعد تفعيل خدمة WSL الخلفية من قسم «المشاركة والوصول» في الإعدادات.",
"a4acf18834787a4f": "يستخدم خادم T3 Code آخر، مثل خدمة الخلفية، مجلد البيانات هذا، أو سبق إعداد خدمة خلفية أقدم لاستخدامه. أوقف ذلك الخادم أو جرّب `t3 update`. إذا تعذّر على المشغّل القديم إجراء التحديث، فشغّل `t3 service uninstall`. يمكنك إعادة تثبيت الخدمة بالأمر `t3 service install` من إصدار حديث لواجهة سطر الأوامر. استخدم `npx t3@latest` إذا كان `t3` مفقودًا أو قديمًا، ومرّر الخيار `--base-dir` مع مجلد T3 الرئيسي للخدمة إلى كل أمر. ثم أعد فتح T3 Code. يمكنك أيضًا ضبط T3CODE_HOME على مجلد منفصل والإقران بالخادم الجاري تشغيله.",
"0e306130a55a3954": "تستخدم خدمة T3 Code في الخلفية مجلد T3 الرئيسي هذا (معرّف العملية {pid}، المنفذ {port}، الإصدار {version}). أوقفها بالأمر `t3 service uninstall` مع تمرير الخيار `--base-dir` ومجلد T3 الرئيسي هذا، ثم أعد فتح T3 Code. يمكنك أيضًا ضبط T3CODE_HOME على مجلد منفصل والإقران بالخادم الجاري تشغيله.",
"7379a43c1ac009d2": "تستخدم خدمة T3 Code في الخلفية مجلد T3 الرئيسي هذا (معرّف العملية {pid}، المنفذ {port}). أوقفها بالأمر `t3 service uninstall` مع تمرير الخيار `--base-dir` ومجلد T3 الرئيسي هذا، ثم أعد فتح T3 Code. يمكنك أيضًا ضبط T3CODE_HOME على مجلد منفصل والإقران بالخادم الجاري تشغيله.",
"1510c6547cde9c2e": "يستخدم خادم T3 Code آخر مجلد T3 الرئيسي هذا، مثل `t3 serve` أو خادم بدأ عبر SSH (معرّف العملية {pid}، المنفذ {port}، الإصدار {version}). إذا بدأه تطبيق T3 Code على جهاز آخر عبر SSH، فسيعيد ذلك التطبيق تشغيله. أزل بيئة SSH من ذلك التطبيق أو اقطع اتصالها أو أنهِ التطبيق. ثم أوقف الخادم وأعد فتح T3 Code. يمكنك أيضًا ضبط T3CODE_HOME على مجلد منفصل والإقران بالخادم الجاري تشغيله.",
"8d8628520de0d9f1": "يستخدم خادم T3 Code آخر مجلد T3 الرئيسي هذا، مثل `t3 serve` أو خادم بدأ عبر SSH (معرّف العملية {pid}، المنفذ {port}). إذا بدأه تطبيق T3 Code على جهاز آخر عبر SSH، فسيعيد ذلك التطبيق تشغيله. أزل بيئة SSH من ذلك التطبيق أو اقطع اتصالها أو أنهِ التطبيق. ثم أوقف الخادم وأعد فتح T3 Code. يمكنك أيضًا ضبط T3CODE_HOME على مجلد منفصل والإقران بالخادم الجاري تشغيله.",
"6574442caf8bfd15": "إعداد إذن تسجيل الشاشة",
"a8210440c691b062": "إعداد إذن تسهيلات الاستخدام",
"0cbbbd8abd25f9d4": "إعداد إذن الوصول الكامل إلى القرص",
"4cd679200c978949": "إغلاق مساعد الأذونات",
"ea4f056c8f6b5c15": "↑ اسحب T3 Code إلى القائمة أعلاه",
"4bcb0f4db00936b1": "اسحب T3 Code إلى إعدادات النظام أو انقر لإظهاره في Finder",
"278648c9ff6fb9ce": "لم تصدر هذه الشهادة عن جهة موثوقة.",
"cf346dcfb658d4d3": "هذه الشهادة غير مخصصة لهذا العنوان.",
"20665d9b0c7c3e52": "انتهت صلاحية هذه الشهادة أو لم يبدأ سريانها بعد.",
"565970a378986341": "فتح",
"00ad8aeed0a6c461": "إلغاء",
"2107cc3e7c4ac833": "هل تريد فتح رابط {protocol} هذا؟",
"050db36de6624203": "تريد صفحة في المتصفح فتح تطبيق آخر:\n\n{url}",
"c1d7515ac0214ca1": "منح الثقة وتذكّر القرار",
"e89b5b30b1bc99bb": "شهادة {host} غير موثوقة",
"16d4c8a1431bd8c2": "صادرة إلى: {name}",
"5862c92e2dabefab": "صادرة عن: {name}",
"cf559f06dc2e5432": "فترة الصلاحية: {start} – {end}",
"86fe6451f52e722a": "بصمة الشهادة: {fingerprint}",
"7b20c92539acb4b6": "امنح الثقة فقط إذا كنت متأكدًا من أن الشهادة تخص الموقع. يُنسى هذا القرار عند مسح ملفات تعريف الارتباط الخاصة بملفك الشخصي الحالي في المتصفح.",
"c67ec08c2c8d0cd9": "تعذّر منح الثقة لشهادة {host}",
"935a340963533dcf": "تعذّر على T3 Code حفظ هذه الموافقة، لذا تظل الصفحة محظورة. تحقق من توفر مساحة على القرص ومن صلاحية الكتابة في مجلد البيانات، ثم حاول مجددًا.",
"a0315d43e8e5be7e": "سماح",
"2ec823ca24387055": "حظر",
"709219ff9ff49a4f": "يطلب {origin} معرفة موقعك",
"8fc0b116123fb50b": "يريد {origin} الاطلاع على النصوص والصور المنسوخة إلى الحافظة",
"c0f756221736393f": "معاينة · {title}",
"6994444f4fec4070": "معاينة المتصفح",
"49de6209699eb616": "مفتاح مرور بلا اسم",
"b4a5bb1075d95154": "اختيار مفتاح مرور",
"61aa0109862ff7ca": "ليلي",
"f3430cac09a505a0": "مستقر",
"1f12213f4d809e89": "لديك أحدث إصدار!",
"c6399b55619e2f67": "T3 Code {version} هو أحدث إصدار متاح حاليًا.",
"b6e5b31255e011c5": "موافق",
"2ee2077700686fbb": "يتوفر تحديث",
"d3104b65052b993b": "يتوفر إصدار جديد من T3 Code.",
"35fff5a1cd1d6473": "يتوفر T3 Code {version}.",
"63fbea040532a9ab": "الإصدار المستخدم هو T3 Code {version}.",
"374b1cb8cb616d27": "تنزيل",
"b0d022fe9d78def7": "لاحقًا",
"b9a0301ee1348da9": "جارٍ تنزيل التحديث",
"bbaf6039d665a7a7": "تنزيل إصدار جديد من T3 Code جارٍ بالفعل.",
"27b49ef7007c126d": "تنزيل T3 Code {version} جارٍ بالفعل.",
"bd6818c7f005654c": "التحديث جاهز",
"e0e13c85665bd62f": "إصدار جديد من T3 Code جاهز للتثبيت.",
"dfe6e415877b0533": "T3 Code {version} جاهز للتثبيت.",
"d1d10979d6dcb162": "سيُعاد تشغيل T3 Code لتثبيت التحديث. ستُقاطَع أي مهام قيد التشغيل.",
"2f0a8211a72e29aa": "إعادة التشغيل",
"116a21f6cc215e5f": "تعذّر التحقق من وجود تحديثات",
"32c88cd9421abf33": "تعذّر التحقّق من التحديثات.",
"9e5ada64a94c10de": "لا يمكن لبناء {build} التحديث من مسار {saved} تلقائيًا. بدّل مسار التحديث مرة أخرى إلى {build}، أو استخدم «مراجعة» بجانب مسار التحديث لإعادة محاولة التبديل إلى {saved}.",
"b37aca07d3c644d9": "حدث خطأ غير معروف. حاول مجددًا لاحقًا.",
"c8c23435e780a60c": "التحديثات غير متاحة",
"aecf7c98b81bef7a": "التحديثات التلقائية غير متاحة حاليًا.",
"835247f842c92bc9": "حول {appName}",
"959e09151d75e25b": "التحقق من وجود تحديثات…",
"0c753e71e2dca0d0": "الإعدادات…",
"d510731926e3ceed": "الخدمات",
"a9fad846cd549d96": "إخفاء {appName}",
"4bd5ee69cf690b2d": "إخفاء الآخرين",
"9d2c1417fb5f62ec": "إظهار الكل",
"4b375f39bfce229e": "إنهاء {appName}",
"83506e64878b7b48": "ملف",
"b1f24efbd4e80225": "إغلاق أدوات المطوّرين",
"2c85ee66be8b81b5": "إغلاق النافذة",
"a4bf583403a4125b": "خروج",
"35b959237c8b221c": "إنهاء",
"31bfa0ca146dc77f": "تحرير",
"8a6e013aa2aba5df": "تراجع",
"ccae47bbef819830": "إعادة",
"228c600d0e283938": "قص",
"30b1b78cffc780c2": "نسخ",
"7aced881395f74eb": "لصق",
"ebf150404ed417d5": "لصق كنص",
"983c993d804f0b29": "حذف",
"efb0c6cb3adb0d8d": "تحديد الكل",
"660715835d05ddca": "النطق",
"f0995859f0a14a6b": "بدء النطق",
"660e62472f879a5f": "إيقاف النطق",
"25994350fd047a38": "عرض",
"573a9e6b17f4e9e3": "إعادة التحميل",
"826cb3059ebc7cc3": "فرض إعادة التحميل",
"8340487d05e832e8": "إظهار أدوات المطوّرين أو إخفاؤها",
"a7ab66e786347118": "الحجم الفعلي",
"a4ad1b27fdc9032d": "تكبير",
"df6ed2014f1737a8": "تصغير",
"50fe114d093a5bc7": "تبديل وضع ملء الشاشة",
"d8c6d6d9845353da": "نافذة",
"f184aa190588625e": "تصغير",
"c20a9deaed71bd1c": "تكبير",
"d207ba3a23f94223": "إحضار الكل إلى المقدمة",
"7a72a6736dd09f82": "مساعدة",
"953979a4737f48fa": "لا توجد اقتراحات",
"202e13f15a3dcd30": "نسخ الرابط",
"8af79268f2349f4c": "نسخ عنوان البريد الإلكتروني",
"a9f9254d458e49fe": "نسخ الصورة",
"9c1b20fbc881de5d": "إعدادات سطح المكتب",
"1b14230874f19eb9": "الصور"
}
3 changes: 2 additions & 1 deletion apps/mobile/gt.config.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"defaultLocale": "en",
"locales": ["es", "zh", "pt-BR", "fr", "de", "ja", "ko", "ru", "sv"],
"locales": ["es", "zh", "pt-BR", "fr", "de", "ja", "ko", "ru", "sv", "ar"],
"src": [
"src/**/*.{ts,tsx}",
"../../packages/client-runtime/src/**/*.{ts,tsx}",
"../../packages/contracts/src/**/*.{ts,tsx}",
"../../packages/shared/src/**/*.{ts,tsx}",
"!**/*.test.{ts,tsx}"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ class T3ComposerEditorView(context: Context, appContext: AppContext) : ExpoView(
editable.setSpan(
ComposerChipSpan(
T3ContextChip(
rtl = layoutDirection == LAYOUT_DIRECTION_RTL,
content = T3ContextChip.Content(
label = token.label,
detail = token.detail,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class T3ContextChip(
fontSize: Float,
private val color: Int,
maximumWidth: Float,
private val rtl: Boolean,
density: Float
) {
/** What the chip says: its name, the size beside it, and the glyph that leads it. */
Expand Down Expand Up @@ -71,14 +72,16 @@ class T3ContextChip(
canvas.translate(x, y)
T3ChipIcons.cached(iconUri)?.let {
val top = (height - em) / 2
canvas.drawBitmap(it, null, RectF(padding, top, padding + em, top + em), iconPaint)
val iconX = if (rtl) width - padding - em else padding
canvas.drawBitmap(it, null, RectF(iconX, top, iconX + em, top + em), iconPaint)
}
val baseline = -paint.fontMetrics.ascent
canvas.drawText(text, padding + iconSlot, baseline, paint)
val textX = if (rtl) padding else padding + iconSlot
canvas.drawText(text, textX, baseline, paint)
if (detailText.isNotEmpty()) {
canvas.drawText(
detailText,
padding + iconSlot + paint.measureText(text),
textX + paint.measureText(text),
baseline,
detailPaint
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,7 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro
font: UIFont
) -> UIImage {
let paragraph = NSMutableParagraphStyle()
paragraph.baseWritingDirection = .leftToRight
paragraph.alignment = .left
paragraph.lineBreakMode = .byTruncatingMiddle
let attributedLabel = NSMutableAttributedString(
Expand Down Expand Up @@ -1106,16 +1107,17 @@ public final class T3ComposerEditorView: ExpoView, UITextViewDelegate, UITextDro
let format = UIGraphicsImageRendererFormat.preferred()
format.opaque = false
let renderer = UIGraphicsImageRenderer(size: CGSize(width: width, height: height), format: format)
let rtl = effectiveUserInterfaceLayoutDirection == .rightToLeft
return renderer.image { _ in
if let icon {
icon.draw(
in: CGRect(x: padding, y: (height - iconSide) / 2, width: iconSide, height: iconSide)
in: CGRect(x: rtl ? width - padding - iconSide : padding, y: (height - iconSide) / 2, width: iconSide, height: iconSide)
)
}
// Exactly the measured width: a spare pixel here would let a capped label draw past
// the cap instead of truncating inside it.
attributedLabel.draw(
in: CGRect(x: padding + iconSlot, y: 0, width: labelWidth, height: height)
in: CGRect(x: rtl ? padding : padding + iconSlot, y: 0, width: labelWidth, height: height)
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.text.Layout
import android.text.SpannableString
import android.text.Spanned
import android.text.StaticLayout
import android.text.TextDirectionHeuristics
import android.text.TextPaint
import android.text.style.BackgroundColorSpan
import android.text.style.ForegroundColorSpan
Expand Down Expand Up @@ -79,6 +80,7 @@ internal fun createCodeLines(text: CharSequence, paint: TextPaint, width: Int):
)
}
val layout = StaticLayout.Builder.obtain(text, 0, text.length, paint, max(1, width))
.setTextDirection(TextDirectionHeuristics.LTR)
.setAlignment(Layout.Alignment.ALIGN_NORMAL)
.setIncludePad(false)
.setBreakStrategy(Layout.BREAK_STRATEGY_SIMPLE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ private final class ReviewDiffTextLayout {

func configure(text: String, font: UIFont, width: CGFloat, characterWidth: CGFloat) {
let paragraph = NSMutableParagraphStyle()
paragraph.baseWritingDirection = .leftToRight
paragraph.lineBreakMode = .byCharWrapping
paragraph.tabStops = []
paragraph.defaultTabInterval = characterWidth * 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
auto fragment = AttributedString::Fragment{};
auto textAttributes = TextAttributes::defaultTextAttributes();

textAttributes.baseWritingDirection = WritingDirection::LeftToRight;
textAttributes.allowFontScaling = baseProps.allowFontScaling;
textAttributes.backgroundColor = props.backgroundColor;
textAttributes.fontSize = props.fontSize * fontSizeMultiplier;
Expand Down
17 changes: 11 additions & 6 deletions apps/mobile/src/components/ComposerToolbar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { ComponentProps, ReactNode } from "react";
import { useCallback, useRef, useState } from "react";
import {
I18nManager,
Platform,
Pressable,
ScrollView,
Expand Down Expand Up @@ -170,7 +171,7 @@ export function ComposerToolbarScroller(props: {
}) {
const metricsRef = useRef({
contentWidth: 0,
offsetX: 0,
offsetX: null as number | null,
viewportWidth: 0,
showLeftFade: false,
showRightFade: false,
Expand All @@ -183,8 +184,9 @@ export function ComposerToolbarScroller(props: {
const updateScrollEdges = useCallback(() => {
const metrics = metricsRef.current;
const maxOffset = Math.max(0, metrics.contentWidth - metrics.viewportWidth);
const showLeftFade = metrics.offsetX > COMPOSER_TOOLBAR_SCROLL_EPSILON;
const showRightFade = metrics.offsetX < maxOffset - COMPOSER_TOOLBAR_SCROLL_EPSILON;
const offsetX = metrics.offsetX ?? (I18nManager.isRTL ? maxOffset : 0);
const showLeftFade = offsetX > COMPOSER_TOOLBAR_SCROLL_EPSILON;
const showRightFade = offsetX < maxOffset - COMPOSER_TOOLBAR_SCROLL_EPSILON;
if (metrics.showLeftFade === showLeftFade && metrics.showRightFade === showRightFade) {
return;
}
Expand Down Expand Up @@ -215,7 +217,8 @@ export function ComposerToolbarScroller(props: {
const handleScroll = useCallback(
(event: NativeSyntheticEvent<NativeScrollEvent>) => {
const offsetX = event.nativeEvent.contentOffset.x;
if (Math.abs(metricsRef.current.offsetX - offsetX) < 1) return;
if (metricsRef.current.offsetX !== null && Math.abs(metricsRef.current.offsetX - offsetX) < 1)
return;
metricsRef.current.offsetX = offsetX;
updateScrollEdges();
},
Expand Down Expand Up @@ -246,7 +249,8 @@ export function ComposerToolbarScroller(props: {
{scrollEdges.showLeftFade ? (
<View
className={cn(
"absolute inset-y-0 left-0",
"absolute inset-y-0",
I18nManager.isRTL ? "end-0" : "start-0",
props.fadeOpaque === undefined && "bg-linear-to-r to-transparent",
props.fadeOpaque === undefined &&
(props.fadeSurface === "sheet" ? "from-sheet" : "from-card"),
Expand All @@ -264,7 +268,8 @@ export function ComposerToolbarScroller(props: {
{scrollEdges.showRightFade ? (
<View
className={cn(
"absolute inset-y-0 right-0",
"absolute inset-y-0",
I18nManager.isRTL ? "start-0" : "end-0",
props.fadeOpaque === undefined && "bg-linear-to-r from-transparent",
props.fadeOpaque === undefined &&
(props.fadeSurface === "sheet" ? "to-sheet" : "to-card"),
Expand Down
Loading
Loading