Open main menu

Gramps β

Changes

Test date handlers

6,133 bytes added, 05:38, 2 January 2015
TO_CHECK
List of date handlers is [[Handler_List|available]].
 
=Date object into Gramps=
 
[[Dates]] in Gramps are much more complex than just a month, day, and year. Dates are always in a particular calendar, can span a time frame, can be approximate, and have support for many other subtleties specific to genealogy data.
 
=Lexeme inflections=
 
A '''lexeme''':
# (''linguistics'') Roughly, the set of inflected forms taken by a single word, such as the lexeme ''RUN'' including as members "''run''" (lemma), "''running''" (inflected form), or "''ran''", and excluding "''runner''" (derived term).
#(''computing'') an individual instance of a continuous character sequence without spaces, used in lexical analysis (token)
 
:source : https://en.wiktionary.org/wiki/lexeme
 
==Types of inflections==
 
{n: nominative}
{g: genitive}
{d: dative}
 
The '''nominative''' cases are found in Estonian, Slovak, Ukrainian, Hungarian, Lithuanian, Georgian, German, Latin, Greek, Icelandic, Old English, Old French, Polish, Serbian, Czech, Romanian, Russian, and Pashto, among other languages.
 
Many languages have a '''genitive''' case, including Albanian, Arabic, Armenian, Basque, Dutch, Estonian, Finnish, Georgian, German, Greek, Icelandic, Irish, Latin, Latvian, Lithuanian, Romanian, Sanskrit, Scottish Gaelic, Turkish and all Slavic languages except Bulgarian and Macedonian.
 
The '''dative''' was common among early Indo-European languages and has survived to the present in the Balto-Slavic branch and the Germanic branch, among others. It also exists in similar forms in several non-Indo-European languages, such as the Uralic family of languages, and Altaic languages.
 
==Examples==
 
#: ../gramps/gen/datehandler/_datestrings.py:70
msgid "localized lexeme inflections||May"
msgstr "И=май|Р=мая|Т=маем|П=мае"
 
==How it is used by Gramps==
 
Gramps extracts all inflections of the same lexeme, stripping the ‘|’, like for context.
 
The possible formats are either (1) a single string for a language with no inflections, or (2) a list of <inflection name>=<inflected form>, separated with ‘|’.
 
For example:
 
#“Uninflectable”
#“n=Inflected-nominative|g=Inflected-genitive|d=Inflected-dative”
 
:See [https://gramps-project.org/docs/gen/gen_utils.html#gramps.gen.utils.grampslocale.GrampsTranslations.lexgettext lexgettext] for more details.
 
=Keys into translation strings=
 
==Related to month inflections==
 
#. If there is no special inflection for "from <Month>" in your
#. language, don't translate this string.
#. Otherwise, translate it to the ENGLISH!!! ENGLISH!!!
#. key appearing above in the FORMATS_... dict
#. that maps to the special inflected format string that you need to localize.
#: ../gramps/gen/datehandler/_datedisplay.py:340
msgid "from-date|"
msgstr ""
 
#. If there is no special inflection for "and <Month>" in your
#. language, don't translate this string.
#. Otherwise, translate it to the ENGLISH!!! ENGLISH!!!
#. key appearing above in the FORMATS_... dict
#. that maps to the special inflected format string that you need to localize.
#: ../gramps/gen/datehandler/_datedisplay.py:369
msgid "and-date|"
msgstr ""
 
#. If there is no special inflection for "before/after/around <Month>" in your
#. language, don't translate this string.
#. Otherwise, translate it to the ENGLISH!!! ENGLISH!!!
#. key appearing above in the FORMATS_... dict
#. that maps to the special inflected format string that you need to localize.
#. TODO are there languages for which the inflections for the different
#. modifiers are different?!
#: ../gramps/gen/datehandler/_datedisplay.py:386
msgid "before-date|"
msgstr ""
 
''date'' on context is maybe confusing?
What about: ''from-month|'', ''and-month|'', ''before-month|''?
 
#. TRANSLATORS: see
#. http://gramps-project.org/wiki/index.php?title=Translating_Gramps#Translating_dates
#. to learn how to select proper inflection for your language.
#: ../gramps/gen/datehandler/_datedisplay.py:450
msgid "{long_month} {day:d}, {year}"
msgstr ""
 
#. TRANSLATORS: see
#. http://gramps-project.org/wiki/index.php?title=Translating_Gramps#Translating_dates
#. to learn how to select proper inflection for your language.
#: ../gramps/gen/datehandler/_datedisplay.py:465
msgid "{short_month} {day:d}, {year}"
msgstr ""
 
#. TRANSLATORS: see
#. http://gramps-project.org/wiki/index.php?title=Translating_Gramps#Translating_dates
#. to learn how to select proper inflection for your language.
#: ../gramps/gen/datehandler/_datedisplay.py:480
msgid "{day:d} {long_month} {year}"
msgstr ""
 
#. TRANSLATORS: see
#. http://gramps-project.org/wiki/index.php?title=Translating_Gramps#Translating_dates
#. to learn how to select proper inflection for your language.
#: ../gramps/gen/datehandler/_datedisplay.py:496
msgid "{day:d} {short_month} {year}"
msgstr ""
 
Need new rules for supporting this type of key format into ''po/check_po'' script.
 
==Specific mapping==
 
#: ../gramps/gen/datehandler/_datedisplay.py:349
msgid "{date_quality}from {date_start} to {date_stop}{nonstd_calendar_and_ny}"
msgstr ""
 
return _("{date_quality}from {date_start} to {date_stop}"
"{nonstd_calendar_and_ny}").format(
date_quality=qual_str,
date_start=d1,
date_stop=d2,
nonstd_calendar_and_ny=scal)
 
Why to use such a code, there?
Same question for:
 
#: ../gramps/gen/datehandler/_datedisplay.py:371
msgid ""
"{date_quality}between {date_start} and {date_stop}{nonstd_calendar_and_ny}"
msgstr ""
 
#: ../gramps/gen/datehandler/_datedisplay.py:388
msgid "{date_quality}{noncompound_modifier}{date}{nonstd_calendar_and_ny}"
msgstr ""
 
=Migrations and refactorings=
 
> $ PYTHONPATH=/usr/local/lib/python2.7/site-packages/ GRAMPS_RESOURCES=$PWD LANGUAGE=de
python -m gramps.gen.datehandler._datestrings
 
LC_TIME={lang_region}.utf8 or LANGUAGE={lang} should match all [[Handler_List|available date handlers]].
 
See # {{bug|6926}} for patches.
Git => revision [http://sourceforge.net/p/gramps/source/ci/918785ad58c6f2a575a7e51704bbaf44e7e63301 918785..]
 
=TO_CHECK=
GRAMPS_RESOURCES=$PWD python -m unittest discover -p 'date*test.py'
{| {{prettytable}}class="wikitable sortable"
! locale
! score
! stats date formats MAX: 8
|-
|ar
|}
> $ PYTHONPATH=/usr/local/lib/python2.7/site-packages/ LC_ALL=fr_FR.utf8 LANG=fr_FR.utf8
GRAMPS_RESOURCES=$PWD python -m gramps.gen.datehandler.__init__
=See also=
* [[Testing Gramps]]
[[Category:Developers/Quality_Assurance]]
[[Category:Developers/General]]