6,817
edits
Changes
From Gramps
m
The displayer class must provide <code>display()</code> method. If you inherit the default implementationאם משתמשם ביישום ברירת המחדל, then all the dates will be displayed in יורשים ממנו את סגנון iso style, without any visible difference between span and range datesכלומר, כל התאריכים יוצגו ללא הבדל גלוי בין תאריכי תקופה וטווח. The next level of customization is to select another pre-canned alternative, provided in the base class, as follows (like DateDisplayEN does):
This will be sufficient for over half of the currently supported languages, that don't tweak the list of formats available for date display. The core of ליבת display_formatted displays both regular and compound datesמציגה תאריכים רגילים ו/או מורכבים, and adorns themומקשטת אותם, if necessaryבמידת הצורך, with modifiers במבחינים (as in כמו "beforeלפני..."), quality indicators מאייכי איכות (as in כמו "calculatedמחושב..."), and calendar/non-standard year start informationולוחות שנה בעלי מידע תחילת שנה לא תקניים.
If your language requires inflections of month names dependent on modifiersכששפת היעד דורשת הטיית שמות חודשים תלויי מבחינים, orאו, for instanceלמשל, whether the date is a start or a stop date in a rangeאם התאריך הוא תאריך התחלה או סיום בטווח, there are special strings you need to translate to indicate the appropriate inflectionנדרש להשתמש ולתרגם מחרוזות מיוחדות כדי לציין את ההטיה המתאימה. Documentation for this advanced scenario can be found in the source code comments to תיעוד לתרחיש מתקדם זה ניתן למצוא בהערות קוד המקור של DateDisplay.
→Providing a localized date displayer class: translation
כל ההטיות שסופקו וכל הקידומות החד משמעיות שלהן יוכרו אוטומטית כמילים נרדפות חוקיות לקוד המחלקה הבסיסית של מנתח תאריכים.
===Providing a localized date displayer classהמקמת מחלקה למצג תאריכים===The displayer class must derive from the מחלקת מתצג התאריכים צריכה להגזר ממחלקת'''DateDisplay''' classבאופן הבא:<div dir="ltr">
from _DateDisplay import DateDisplay
class MyDateParser(DateDisplay):
...
</div>
בנוסף היא אמורה לספק שיטת <code>display()</code>.
הרמת ההתאמה האישית הבאה תהיה בחירת חלופה "ארוזה" מראש אחרת, שמסופקת במחלקה הבסיסית, כדלקמן (כפי ש־DateDisplayEN עושה):
<div dir="ltr">
display = DateDisplay.display_formatted
</div>
התאמה זו תתאים ליותר ממחצית מהשפות הנתמכות נכון להיום, שפות שלא מטפללות את רשימת המשתנים הזמינים למתצג התאריך.
If your language overrides Display.formats to something else, it should also override _display_calendar (or, separately, the _display_gregorian/_display_hebrew/... whatever methods that delegate to _display_calendar by default with the appropriate month lists). The override of _display_calendar should format the date according to the currently selected custom format, using self.format number as an index into the self.formats list.