Hebrew relationship translator/calculator

@Nick-Hall @emyoulation

Gramps version 5.2.0 beta
Linux mint 21.2

I completed translating and testing rel_he.py and it seems to work w/o errors finally. However, I need some (python???) help with a specific case that effects the whole code.
I Hebrew we will need 4 “step” rather then just one: feminine/masculine, singular/plural.
I’ve seem something similar in rel_fr.py but my coding skills are at monkey see monkey do level…

I fear my skills aren’t quite so evolved. I’d rate them at the “monkey see, monkey scratch armpit” stage.

You should have translated the methods get_plural_relationship_string and get_single_relationship_string. The comments in the English version describe the parameters.

The plural relationship describes the relationship between a person and a group of people with the same relationship, so you don’t know the gender of the people in the group. I don’t know if this is a problem.

For the single relationship you are given the gender of the two people involved in the variables gender_a and gender_b. You can use these variables to determined the translation of “step”.

It is possible that you may need to translate get_sibling_relationship_string if the logic of uncle, aunt sibling relationship descriptions is different from English.

I don’t mind looking at your code to see if I can help.

This is all done. All tests passes.
in English “step” works for all" step son, step doubter step mother and so on.
While in Hebrew "step (gen male) has one form i.e “אח שלוב” (step brother), and "step (gen female) has a different form i.e “אחות שלובה” (step sister). Each case has its plural form as well: “אחים שלובים” (step brothers) and “אחיות שלובות” (step sisters).
Current result are: “אחות שלוב” and “אחיות שלוב”…
Hope this better explains the issue

For the singular case , you could define a couple of new constants:

STEP_M = "שלוב"
STEP_F = "שלובה"

and then in the get_single_relationship_string method use logic similar to:

if only_birth:
    step = ""
    if gender_b = MALE 
        step = self.STEP_M
    elif gender_b = FEMALE 
        step = self.STEP_F
        step = "?" # Change this as appropriate for other and unknown gender

For the plural case, you will have step siblings rather than step brothers or step sisters.

Thanks @Nick-Hall, worked like charm… :magic_wand:


I still have some English stuff in there that was unable to remove.
For Hebrew, 11 levels are more then enough, so i kept all level lists, at the first par of the script, 11 levels long. For some reason “_SON_LEVEL” and “_DAUGHTER_LEVEL” brakes the code if the lists are shorthorn than 30. I was assuming there is a param in the scrip to set the depth but couldn’t find the way to tweak it. If there is no easy way to do so, I’ll just translate those two list all the way to lvl30

I think the precedence of the שלובה should have higher importance.
Meaning that נכדה שלובה מרמה חמישית is better than נכדה מרמה חמישית שלובה for example.

Also the term שלובה, although well known is the less popular term for the term step, חורגת is much more popular.

Did you define the strings DIST_SON and DIST_DAUGHTER? These are used when the relationship level exceeds the number of items in the lists.

Send me the code when you are ready, and I’ll include it for you.

True, I’ll re-arrange the wording order to make more sense Hebrew once i figure out how to deal with singular/plural form in the script. Keep in mind however that in Hebrew the the descriptive name for (son/doub) fifth generation and up is: “בת־מרמה־חמישית”, “בן־מרמה־חמישית”

“person” “step” “in-low” " removed" “level”
“נכדה־מרמה־אחת־עשרה שלובה מחיתון מדגרה שניה”
“נכדה־מרמה־אחת־עשרה, שלובה, מחיתון, מדגרה שניה”

The old (but still in use) word suggests “segregation”, “segmentation” and “exclusion”, the new one suggests “integration”, “acceptance” and “inclusion”.

I did…

DIST_SON = "צאצא רחוק %(step) %(inlaw)s (%(level)d דורות)"

def _get_son(self, level, step="", inlaw=""):
    Internal english method to create relation string
    if level > len(_SON_LEVEL) - 1:
        return self.DIST_SON % {"step": step, "inlaw": inlaw, "level": level}
        return _SON_LEVEL[level] % {"step": step, "inlaw": inlaw}

Same for get_doubter…
I couldn’t figure out the singular/plural tweak yet ;(
Visually it looks also like the Indent is of too, very difficult to manipulate bi-di placings.

1 Like

Just notice a small typo so it won’t infiltrate the code: מדרגה.

And another small one is שנייה instead of שניה (same goes for פנייה over פניה) as explained here.
The version without the commas is easier to read because it doesn’t interrupt the reading flow.
I would also lose the Maqaf, since there are so many words that need it it’s just annoying.

It is a social change we need to make in Israel but for now it’s not as popular for the greater public.

No worries its not in the code, my Dyslexia just kicked in trying to prove i still got it…

(adapting your sharing Technique…) Here is a working copy of " rel_he.py".
I’d love to keep on Trial and error-ring this some more, but once again, I’m fare from being any sort of coder.

1 Like

I removed some parts of your code that were not required and created PR #1575.

The indent problem was caused by the “inlaw” and “step” substitution variables. Your strings have spaces between the variables and substituting empty strings left a couple of unwanted spaces. To make the problem more visible, the empty strings were interpreted as LTR and placed it the front of the strings for some reason.

There are two solutions to the problem:

  1. Remove the spaces from your strings and add them in the in-law and step strings.
  2. Use the strip() function to remove the unwanted spaces.

I’ve taken the second approach for now. It was easier for me than editing the mixed LTR and RTL strings.

1 Like

Great thanks @Nick-Hall,
Trust me editing “bi-directional text on an Hebrew environment” is worst then a nightmare, where characters are thrown all over the line moving other stuff (tags, Latin chars and pieces of code) around until one can not tell head from tail any more. :grimacing: not much fun.

I thought it may have been a problem with my setup. I feel a bit better now that I know it’s difficult for everyone.

Anyway, I’ve gone ahead and merge both this and the date handler. They should both be working now, but if we find bugs we can always fix them later.

I’m currently having “add-on manager” issues both on beta 2 and 3, when that is fixed, I’ll look at both ‘date’ and ‘rel’ thoroughly, so I’m pretty sure this is not the last you’re gonna hear from me about it ;-/
Also I’m still eager to tweak that singular/plural form too.

“About” is still failing…

is the closest string we have in the parser for "About".

Is this a typo? I can add another entry if you want.

Gotten slapped on my wrist for using the wrong branch for testing 5.2 (probably rightfully too), I re-based to maintenance/gramps52 and it seems to work as is… BUT

Look at the column “Age” (גיל) (marked “1” and “2” then on column “date” (תאריך) marked “3”.
“1” and “2” are not from the date handler and need to be tweaked too.

This is OK, however we might want to add a substitution list to the handler containing words one might use verbally describing the dates quality “בסביבות, בערך ב, באזור ה, קרוב ל, בקרוב, במקורב”