I've been looking at a bug in the code which creates names of relationships. The code is not only a little complicated, it highlights a problem with the language files - we always load english first.
There are relationships that have english names that may not exist on other languages. For example, in english, my "sister's husband's sister" is my "sister-in-law". Other languages may not have a name for this relationship.
Also, we have the same word in english, that may be different in other languages. For example, my "father's sister" and my "mother's sister" are both called "aunt". This may be different in other languages.
So, I'd like to propose a new language file that contains the relationship names; relationship.XX.php. Unlike the other language files, we *won't* load the english ones first. This way we'll only have definitions that exist for the current language. The relationships will be defined by the individual links. e.g.
We'd also need some code (per language) to identify patterns such as "Nth Cousin, M times removed" - but we already have much of this.
This approach would appear to be simple, efficient and flexible.
I could create the initial files, (using the current translations), but I would obviously need a native speaker to review them.
Any comments on this?
Why not just fix the relevant language files so that relationships that are defined in the English language file but don't have an equivalent in the other language are simply made empty in that other language file?
The relationship code should be amended to test for empty() instead of isset(). As you know, an undefined variable is also empty.
However, if your goal is to make the language file sizes somewhat more manageable, splitting out all the relationship stuff will certainly achieve this.
<<The relationship code should be amended to test for empty() instead of isset().>>
True, but if a new relationship name is added to English, then all the other files would need to be updated - and we wouldn't know whether to leave it alone (because a tranlsation exists, though we don't know what it is) or set it to empty (because we know that one doesn't).
<<make the language file sizes somewhat more manageable>>
Because I'd need more variants than exist at present, such as "mother-sister" and "father-sister" both being "aunt", there would naturally be some duplication in most languages.
But as you say, we only need these definitions on a couple of pages, so it would cut down the size of $pgv_lang for all the others.
The main advantages are that it will be very simple, flexible, and easy to understand/maintain.
At the moment, we'd need special code to split "mother-sister" and "father-sister" into two definitions. A simple lookup table is a much cleaner way to do it.
Indonesian don't have common translation for halfsibling. We have translation for half and sibling, but it is uncommon in Indonesian to make a frase from them. Indonesian have separate words for father's child and mother's child. Currently I join those two in the translation. May PGV accomodate those in the next release? Thank you.
If Indonesian doesn't make a distinction in the same family between children who only share one parent, then simply translate "half-brother" to "brother", "half-sister" to "sister", "half-sibling" to "sibling".
I certainly never refer to my half-sister as "half-sister". She's my "sister".
I mean Indonesian distinc between children who only shared father and children who only shard mothr. Both in Englsh are the same, halfsiblg. Right, we can use sibling for halfsibling. Howevr, for descriptive purpose, we distint them.
<<Indonesian distinc between children who only shared father and children who only shard mothr.>>
This is a good example of my original point.
You can define a half-sibling in many ways. There are 9 combinations (male/female/unknown parent and male/female/unknown child). In english, these are the definitions
mother-daughter = half-sister
mother-son = half-brother
father-daughter = half-sister
father-son = half-brother
parent-daughter = half-sister
parent-son = half-brother
father-child = half-sibling
mother-child = half-sibling
parent-child = half-sibling
Rather than introduce lots of complicated code for different languages, it is much simpler to allow each language to define each of the relationships in a table. It means that they can be easily updated by translators, rather than programmers.
Of course, there are a lot of combinations, and this may be a long list.
I'm not saying that this is *definitely* the way to go. I'm just suggesting a possible solution to this problem.
BTW - are there any other "complications" that we must consider. For example, older-brother/younger-brother.