FIND
#AbuDhabi
#architecture
#Archive_image
#calligraphy
#coffee
#currency
#design
#Dubai
#Featured
#FIND_ADguide
#FIND_ADguideIntro
#FIND_ADTree
#FIND_Alaa
#FIND_Alia
#FIND_AlMandi
#FIND_AlMutairi
#FIND_AncientArabia
#FIND_ArtistPortrait
#FIND_Artists
#FIND_Bianca
#FIND_BusStation
#FIND_correspondence
#FIND_Dual
#FIND_DubaiTopos
#FIND_Fadi
#FIND_Felix
#FIND_Gate
#FIND_Hala
#FIND_Hasan
#FIND_Imrana
#FIND_Maha
#FIND_Maitha
#FIND_Manal
#FIND_May
#FIND_Maya
#FIND_Mo
#FIND_Mobius
#FIND_MovingAD
#FIND_Munira
#FIND_Nasser
#FIND_Noor
#FIND_Pascal
#FIND_Rajaa
#FIND_RAKportrait
#FIND_Ramadan
#FIND_Reem
#FIND_Reversible
#FIND_Robert
#FIND_Roberto
#FIND_Rubicon
#FIND_Ruth
#FIND_Rym
#FIND_SalehPortrait
#FIND_Salem
#FIND_Samer
#FIND_Saudi
#FIND_Scholars
#FIND_Shakhbut
#FIND_Sherri
#FIND_Solertium
#FIND_SoundSteps
#FIND_stamps
#FIND_Suheyla
#FIND_UAE
#FIND_UAEchefs
#FIND_UAEobjects
#FIND_via_GCI
#FIND_via_Instagram
#FIND_via_Medium
#FIND_VoiceReclaimed
#FIND_workshops
#FIND_Yasser
#Home
#Issue_1
#Issue_2
#Issue_3
#Issue_4
#Issue_5
#Khaleej
#maps
#mountains
#NotesFromTheField
#portraits_people
#portraits_place
#RAK
#revart14
#Sharjah
#transportation
#UAE
#UAE_Art
#UAE_Film
#UAE_History
#
#
#
#
#
#1_الإصدار رقم
#2_الإصدار_رقم
#3_الإصدار_رقم
#4_الإصدار_رقم
#5_الإصدار رقم
#ابحث_آلاء
#ابحث_الأدوات_الإماراتية
#ابحث_الإمارات
#ابحث_الجزيرة_العربية_القديمة
#ابحث_السعودية
#ابحث_الفنانين
#ابحث_المطيري
#ابحث_المندي
#ابحث_باحثين
#ابحث_باسكال
#ابحث_بوابة
#ابحث_ بيانكا
#ابحث_تحريك_أبوظبي
#ابحث_حسن
#ابحث_خطى_الصوت
#ابحث_دبي_توبوس
#ابحث_دليل_أبوظبي
#ابحث_دليل_أبوظبي_مقدمة
#ابحث_رجاء
#ابحث_رمضان
#ابحث_روبرت
#ابحث_روبرتو
#ابحث_روبيكون
#ابحث_روث
#ابحث_ريم
#ابحث_ريم
#ابحث_سالم
#ابحث_سامر
# ابحث_سهيلة
#ابحث_سوليرتيوم
#ابحث_شجرة_أبوظبي
#ابحث_شخبوط
#ابحث_شيري
#ابحث_صوتي
#ابحث_صورة_الفنان
#ابحث_صورة_رأس_الخيمة
#ابحث_صورة_صالح
#ابحثـطهاةـالامارات
#ابحث_طوابع
#ابحث_عالية
#ابحث_عمرانا
#ابحث_فادي
#ابحث_فيلكس
#ابحث_مايا
#ابحث_محطة_الحافلات
#ابحث_مراسلة
#ابحث_مزدوج
#ابحث_منال
#ابحث_منيرة
#ابحث_مها
#ابحث_مو
#ابحث_موبيوس
#ابحث_مي
#ابحث_ميثاء
#ابحث_ناصر
#ابحث_نور
#ابحث_هلا
#ابحث_ورش_العمل
#ابحث_ياسر
#أبوظبي
#أرشيف_الصور
#الإمارات
# الإمارات_فيلم
#الخط
#الخليج
#الشارقة
#الصفحة الرئيسية
#العملة
#القهوة
#المميز
#تاريخ_الإمارات
#تصميم
#جبال
#خرائط
#دبي
#رأس_الخيمة
#صور_المكان
#صور_الناس
#فن_الإمارات
#ملاحظات_من_الميدان
#هندسة_معمارية
#وسائل_النقل
contributors
events
fellowships
notebook
stories
Forming Intersections and Dialogues
تطبيق ثنائي اللغة خاص بموقع ابحث
Bilingual Implementation for the FIND website
Bilingual code example
في أوّل رحلة لي على متن طائرةٍ لناقل يتخذ مقراً له في الإمارات، قضيت الأربعة عشر ساعة التي استغرقتها الرحلة منهمكاً تماماً بالعلامات والميديا المتناظرة على نحو جميل، وثنائية اللغة عربية/ إنجليزية التي كانت تحيط بي. كان قد سبق لي أن عملت على مشاريع باللغتين العربية والإنجليزية من قبل، لكني لم أرهما تستخدمان معاً بمثل هذه السلاسة. كان من الواضح أن مصممي الشركة يؤمنون إيماناً عميقاً بإمكانية تكامل التصاميم وأنهم قد أفادوا تماماً من وجهة كل لغة.

وبتخويلنا العمل على جمع العربية والإنجليزية معاً وعلى نحو متناسق، فإنَّ ابحث وضعنا، كفريق إنترنت تنفيذي، أمام تحدٍّ فريد. ففي عالم مُتْرَع بالحواسيب والهواتف، مهمتنا هي جعل ذلك التصميم المتكامل، وثنائي الاتجاه، وثنائي اللغة جميلاً في شتّى وسائل التصفح المختلفة وبطريقة قابلة للاستخدام.
ومن حسن الحظ ، أنَّ HTML و CSS قطعاً شوطاً طويلاً في الآونة الأخيرة، سواء في دعم اللغات التي تُكتب من اليمين إلى اليسار أم في تقدم الأدوات الحساسة التي تصلح للتعامل مع مثير من الأجهزة مختلفة الأحجام. وما كنا لنتمكن من إنشاء موقع ابحث في شكله الحالي باستخدام التقنيات التي كانت سائدة قبل خمس سنوات فقط.
اللبنة الأساسية في أي موقع إنجليزي/عربي ثنائي اللغة هي الخاصيّة CSS
direction: rtl
تؤثّر هذه الخاصية على عدد من الخصائص التصميمية الأخرى التي تجعل كتلة HTML قابلة للقراءة باللغة العربية أو أي لغة أخرى من اليمين إلى اليسار. وبدلاً من أن يكون مبتدأ النصّ الافتراضي من اليسار ويتجه إلى اليمين، فإن مبتدأه يكون من اليمين ويتجه إلى اليسار. وتوفّر جميع المتصفحات الحديثة دعماً جيداً لهذه الخاصيّة. لذلك، سوف أبدأ به كمثال بسيط لكيفية عمل ترميز ابحث ثنائي اللغة.
لدى تنزيل الآراء على ابحث، نستخدم لغة تُدعى Slim. وهي تتيح لنا استخدام اختزال للفئات وسواها من أنواع الترميز، الأمر الذي يتماشى كثيراً مع CSS ويقلل من كمية الترميز بالأقواس المكسورة المطلوب. وسوف أبيّن ذلك في ما يلي:
إذا افترضنا الـ CSS:
.ar {
  direction: rtl;
}
يمكننا أن نكتب كود Slim البسيط والمقروء:
.ar العربية   
.en English
الذي يولّد هذا الـ HTML (الأطول) الذي سيُرسَل إلى المتصفح:
<div class="ar">
العربية    
</div>
<div class="en">
English    
</div>
يتيح لنا ذلك تصميماً مقبولاً لسلاسل النص الطويلة، حيث نريد جملة عربية أو فقرة عربية، تُعرَض من اليمين إلى اليسار، تتلوها ترجمتها الانجليزية، من اليسار إلى اليمين.
بالنسبة إلى السلاسل الأقصر، غالباً ما نرغب في الاستفادة من التناظر على نفس الخط. وتشمل الأدوات التي يمكن استخدامها الجداول، العناصر الحرة، والتموضع المطلق. تم إهمال عنصر HTML TABLE القديم بقوة كأداة تخطيط؛ ذلك أنه لأسباب الوصول والترميز النظيف، من بين أسباب أخرى، لا ينبغي لهذا العنصر أن يستخدم إلا لتمثيل جداول البيانات الفعلية.
يستخدم ابحث عناصر حرة في معظم الأماكن، وتموضعاً مطلقاً في عدد قليل منها. ويمكن للعناصر الحرة أن تكون تحدياً لا بدّ من التصدي له مباشرة. وأساسيات العمل هي على النحو:
/* CSS */
.float_right {
  float: right;
}
/ Slim
.ar.float_right العربية   
.en English
<!-- HTML -->
<div class="at float_right">
العربية    
</div>
<div class="en">
English    
</div>
هذا يسفر عن التصميم المطلوب لهذا المثال، لكنه لا يتعامل معه على النحو الحسن إذا ما كانت النصوص العربية والإنجليزية تتصادم، إما بسبب تغيير حجم النافذة، أو لأن النص طويل جدا. عندئذ سوف تتداخل ببساطة مع بعضها بعضاً بمجرد أن تقترب من بعضها بعضاً. ويمكن إنهاء ذلك بتحرير كل من العربية والانجليزية وتصحيح بعض الأحجام:
/* CSS */
.float_left {
  float: left;
  width: 50%;
}
.float_right {
  float: right;
  width: 50%;
}
/ Slim
.ar.float_right العربية   
.en.float_left English
<!-- HTML -->
<div class="ar float_right">
العربية    
</div>
<div class="en float_left">
English    
</div>
للأسف، الآن وقد باتت جميع المحتويات عناصر حرة، علينا أن نعترف بأن بعض التفاصيل أكثر تعقيدا من نموذج الصندوق المغلق CSS: حجز مساحة شاقولية للعناصر الحرة، التأكد من أن المحتوى اللاحق يمسح العناصر الحرة، الخ. وحقاً، عندما يعدَّل حجم المتصفح إلى حجم صغير، سواء على هاتف أو كمبيوتر صغير، نفضل أن نعود مرة أخرى إلى التصميم من الأعلى إلى الأسفل الذي بدأنا به.
هذا هو المكان الذي يكون فيه إطار CSS الشبكي مفيداً، حيث يعنى بصورة موثوقة بتفاصيل التطبيق هذه ويوفّر سلوكاً مستجيباً حيال أحجام الشاشة المختلفة. والحال، إن ابحث يستخدم Twitter Bootstrap 3، الذي يوفر مفردات CSS لشبكة من 12 عموداً.
/ Slim
.container
  .row
    .ar.pull-right.col-sm-6 العربية   
    .en.col-sm-6 English
<!-- HTML -->
<div class="container">
  <div class="row">
    <div class="ar pull-right col-sm-6">
العربية    
    </div>
    <div class="en col-sm-6">
    English    
    </div>
  </div>
</div>
هذا ينجز الكثير من العمل بالنسبة إلينا. حيث نضع العربية في عمود شبكة يستهلك نصف المساحة المتوفرة، واللغة الإنجليزية في عمود شبكة يستهلك النصف الآخر. هذا يتوافق مع الـ "6" in "col-sm-6" ، حيث 6 هو نصف الـ 12 عمود المتوفرة في الشبكة.
يشير المختصر"sm" في نمط CSS إلى"small" (صغير) ويخبر Bootstrap أن يستخدم التصميم العمودي على الأجهزة الصغيرة فالأكبر، ولكن على أن يعود إلى تصميم مكدّس، غير عمودي مع الأجهزة الأخرى. وفي لغة Bootstrap، فإنَّ "small" هو حجم شاشة يتوافق تقريبا مع آيباد في اتجاه عمودي. حتى الأجهزة الأصغر، مثل الهواتف، توصف بأنها "extra small" التي تُكتب على النحو "xs" في النمط CSS . لذلك، قمنا بإنشاء تصميم يكدس الإنجليزية والعربية على الهاتف، لكنه يضعهما في أعمدة متناظرة على جهاز أكبر.
عادة ما يضع Bootstrap كل ما يأتي أولاً في HTML في العمود أقصى اليسار، لكننا لا نريد ذلك، فنغيّر السلوك بإضافة الفئة "pull-right"، وهي من فئات CSS المعرّفة على Bootstrap، إلى الجزء العربي. وذلك يجعلها تظهر في العمود الأيمن وأعلى المكدس.
التموضع المطلق مفيد في بعض الحالات التي نحتاج فيها إلى تبديل محتوى موجود.
للقيام بذلك، نرفق خاصية CSS التي هي"position: relative" إلى العنصر الأصل، مثل div يحمل الصورة التي سيتم تبديلها. ثم نعبر عن المكان الذي نريد فيه المحتوى المبدّل، إلى الأعلى، أو اليسار، أو اليمين، أو الأسفل من العنصر الأصل.
/* CSS */
.parent {
  position: relative;
}
.child_left {
  position: absolute;
  left: 10px;
  bottom: 10px;
}
.child_right {
  position: absolute;
  right: 10px;
  bottom: 10px;
}
/ Slim
.parent
  img src="example.jpg"
  .ar.child_right العربية   
  .en.child_left English
<!-- HTML -->
<div class="parent">
  <img src="example.jpg">
  <div class="ar child_right">
العربية    
  </div>
  <div class="en child_left">
    English    
  </div>
</div>
على غرار مثال العنصر الحر أعلاه، علينا أن نمارس بعض العناية الإضافية لتجنب اصطدام نص طويل أكثر من اللازم، من خلال تحديد العرض بشكل واضح وخصائص التجاوز. ولكن بما أن التموضع المطلق لا يفيد إلا في الحالات التي تكون فيها الأبعاد معروفة جيدا، فإنَّ هذه المشكلة يمكن تدبّرها.
باتباع أنماط ثابتة وبسيطة لتحديد النصوص العربية والإنجليزية في ابحث باستخدام CSS ، وجدنا أنه من السهل القيام بتعديلات بسيطة على CSS بغية تحقيق أفضل التوازن والتناظر في تصاميمنا. الأهم من ذلك، ما دمنا نستخدم خطوطاً مختلفة للغة العربية والإنجليزية، أحيانا يحتاج حجم الخط وارتفاعه بحيث تتنزل النصوص متعددة الخطوط بالصورة الملائمة.
كما وجدنا أنه كلما جعلنا ترميز الـ CSS لدينا أكثر اتساقاً وبساطة في تحديد النصوص العربية والإنجليزية، سهل على ما لدينا من نظام إدارة المحتوى ثنائي اللغة القيام بعمله. وسوف أقول المزيد عن إدارة محتوى ابحث.
نحن نتعلم ونتطور ونمضي قُدُمَاً. وأشعر أن ابحث يؤمن بوجود اللغتين معاً إلى درجة قلما رأيتها في مكان آخر على شبكة الإنترنت، ولذلك نحن نستكشف آفاق جديدة مع كل ميزة ننتجها. واسمحوا لنا أن نعرف إذا كان لديكم أية أفكار أو اقتراحات بشأن كيفية جعل ابحث أكثر قابلية للقراءة بالنسبة لكم وعلى الأجهزة المفضلة لديك .
On my first flight on a UAE-based carrier, I spent all fourteen hours totally engrossed in the beautifully symmetrical, bilingual English/Arabic signage and media that surrounded me. I had worked on projects in English and Arabic before, but had not seen them used together so seamlessly. The airline’s designers deeply embraced the potential for complementary layouts and took full advantage of the directionality of each language.

With a mandate to have consistently co-present Arabic and English, FIND presents us, as a web implementation team, with a unique challenge. In a world full of tablets and phones, our job is to bring that beautiful, complementary, bidirectional, bilingual design aesthetic to many different browsing devices in a usable way.
Fortunately, HTML and CSS have come a long way recently, both in supporting right-to-left languages and in offering the responsive tools to handle many different device sizes. We could not have built the FIND website in its current form using the prevalent technologies of just five years ago.
The basic building block of any bilingual English/Arabic site is the CSS property
direction: rtl
This property influences a number of other layout properties to cause a block of HTML to be readable in Arabic or another right-to-left language. Instead of being default aligned left and flowed to the right, text is default aligned right and flowed to the left. This reversal applies to inline elements and floats, causing anything within a block so marked to facilitate a right-to-left reading order. All modern browsers have good support for this property. So, I'll start with it as a simple example of how FIND's bilingual markup works.
In implementing the views for FIND, we use a language called Slim. It allows us to use a shorthand for classes and other markup, which corresponds more closely to the CSS and reduces the amount of angle-bracket markup required. I'll show it throughout as an intermediate step.
So, given the CSS:
.ar {
  direction: rtl;
}
we can write the simple, readable Slim code:
.ar العربية   
.en English
Which generates this (longer) HTML to be sent to the browser:
<div class="ar">
العربية    
</div>
<div class="en">
English    
</div>
That gives us an acceptable layout for long strings of text, where we want an Arabic sentence or paragraph, presented right-to-left, followed by its English translation, presented left-to-right.
For shorter strings, we often want to take advantage of symmetry on the same line. Tools we can use include tables, floats, and absolute positioning. The old HTML <table> element is strongly deprecated as a layout tool; for accessibility reasons and clean markup, among other reasons, it should only be used to represent actual tables of data.
FIND uses floats in most places, and absolute positioning in a few others. Floats can be challenging to work with directly. The fundamentals work like this:
/* CSS */
.float_right {
  float: right;
}
/ Slim
.ar.float_right العربية   
.en English
<!-- HTML -->
<div class="at float_right">
العربية    
</div>
<div class="en">
English    
</div>
This yields the desired layout for this example, but it won't handle it well if the English and Arabic texts collide, either because the window is resized, or because the text is too long. They'll simply overlap each other once they get too close. We can fix this by floating both the Arabic and the English, and setting some sizes:
/* CSS */
.float_left {
  float: left;
  width: 50%;
}
.float_right {
  float: right;
  width: 50%;
}
/ Slim
.ar.float_right العربية   
.en.float_left English
<!-- HTML -->
<div class="ar float_right">
العربية    
</div>
<div class="en float_left">
English    
</div>
Unfortunately, now that all our content is in floats, we have to acknowledge some more complex details of the CSS box model: reserving vertical space for the floats, making sure that subsequent content clears the floats, etc. And really, when the browser is resized to a small size, say on a phone or small tablet, we'd prefer to fall back to the top-and-bottom layout we started with.
This is where a CSS grid framework comes in handy, to reliably take care of these implementation details and provide responsive behaviors for different screen sizes. FIND uses Twitter Bootstrap 3, which provides a CSS vocabulary for a 12-column grid.
/ Slim
.container
  .row
    .ar.pull-right.col-sm-6 العربية   
    .en.col-sm-6 English
<!-- HTML -->
<div class="container">
  <div class="row">
    <div class="ar pull-right col-sm-6">
العربية    
    </div>
    <div class="en col-sm-6">
    English    
    </div>
  </div>
</div>
This does a lot of work for us. We lay out the Arabic in a grid column consuming half the available space, the English in a grid column consuming the other half. This corresponds to the "6" in "col-sm-6" - 6 is half of the 12 columns available in the grid.
The "sm" in the CSS style stands for "small" and tells Bootstrap to use the columnar layout on small devices and up, but fall back to a stacked, non-columnar layout on others. In Bootstrap parlance, "small" is a screen size that corresponds roughly to an iPad in vertical orientation. Even smaller devices, like phones, are labeled as "extra small" and use "xs" in the CSS style. So, we have created a layout that will stack the English and the Arabic on a phone, but put it in symmetrical columns on a larger device.
Normally Bootstrap would put whatever comes first in the HTML in the leftmost column, but we don't want that, so we change the behavior by adding the Bootstrap-defined CSS class "pull-right" to the Arabic part. That makes it appear in the right column and the top of the stack.
Absolute positioning is useful in certain cases where we need to overlay existing content.
To do this, we attach the CSS property "position: relative" to the parent element, such as a div holding the image to be overlaid. Then we express where we want our overlay content in terms relative to the top, left, right or bottom of the parent element.
/* CSS */
.parent {
  position: relative;
}
.child_left {
  position: absolute;
  left: 10px;
  bottom: 10px;
}
.child_right {
  position: absolute;
  right: 10px;
  bottom: 10px;
}
/ Slim
.parent
  img src="example.jpg"
  .ar.child_right العربية   
  .en.child_left English
<!-- HTML -->
<div class="parent">
  <img src="example.jpg">
  <div class="ar child_right">
العربية    
  </div>
  <div class="en child_left">
    English    
  </div>
</div>
Like the manual float example above, we have to exercise some additional care to avoid overly long text colliding, by setting explicit widths and overflow properties. But since absolute positioning is only useful in cases where the dimensions are well known, this problem is manageable.
By following consistent and simple patterns for identifying Arabic and English texts in FIND using CSS, we have found it easy to make small tweaks to the CSS to achieve better balance and symmetry in our layouts. Most importantly, because we use different fonts for Arabic and English, sometimes font-size and line-height properties need adjustment so that multiline texts lay out neatly.
We also found that the more consistent and simple we make our CSS markup to identify Arabic and English texts, the easier it is for our bilingual content management system to do its job. I'll talk more about content management for FIND in my next post.
We're learning and improving as we go along. I feel that FIND has embraced bilingual co-presence to a degree that I have seldom seen elsewhere on the web, so we're breaking some new ground with each feature we produce. Please let us know if you have any ideas or suggestions as to how to make FIND more readable for you on your favorite device.
يناير 15، 2014
روب هايتمان
Jan 15, 2014
Rob Heittman