diff options
| -rw-r--r-- | includes/classes/class_event.php | 2 | ||||
| -rw-r--r-- | includes/classes/class_i18n.php | 11 | ||||
| -rw-r--r-- | includes/classes/class_treenav.php | 10 | ||||
| -rw-r--r-- | includes/config_data.php | 16 | ||||
| -rw-r--r-- | includes/controllers/lifespan_ctrl.php | 14 | ||||
| -rw-r--r-- | modules/GEDFact_assistant/_CENS/census_3_find.php | 2 | ||||
| -rw-r--r-- | modules/GEDFact_assistant/_MEDIA/media_3_find.php | 2 |
7 files changed, 31 insertions, 26 deletions
diff --git a/includes/classes/class_event.php b/includes/classes/class_event.php index 13cb17464a..c44eff6626 100644 --- a/includes/classes/class_event.php +++ b/includes/classes/class_event.php @@ -281,7 +281,7 @@ class Event { function getLabel($abbreviate=false) { if ($abbreviate) { - return i18n::fact_abbreviation($this->tag); + return abbreviate_fact($this->tag); } else { return translate_fact($this->tag, $this->parentObject); } diff --git a/includes/classes/class_i18n.php b/includes/classes/class_i18n.php index 6be232bbe8..1f9157604d 100644 --- a/includes/classes/class_i18n.php +++ b/includes/classes/class_i18n.php @@ -243,17 +243,6 @@ class i18n { } } - // Provide a (one letter) abbreviation of a fact name for charts, etc. - static public function fact_abbreviation($fact) { - $abbrev='ABBREV_'.$fact; - if (i18n::is_translated($abbrev)) { - return i18n::translate($abbrev); - } else { - // Just use the first letter of the full fact - return utf8_substr(i18n::translate($fact), 0, 1); - } - } - // Convert a GEDCOM age string into translated_text // NB: The import function will have normalised this, so we don't need // to worry about badly formatted strings diff --git a/includes/classes/class_treenav.php b/includes/classes/class_treenav.php index f5e9a57bb8..0ad88bc4db 100644 --- a/includes/classes/class_treenav.php +++ b/includes/classes/class_treenav.php @@ -311,9 +311,9 @@ class TreeNav { </span><br /> <div class="details1 indent"> <?php - echo '<b>', i18n::fact_abbreviation('BIRT'), '</b> ', $person->getBirthDate()->Display(), ' ', PrintReady($person->getBirthPlace()), '<br />'; + echo '<b>', abbreviate_fact('BIRT'), '</b> ', $person->getBirthDate()->Display(), ' ', PrintReady($person->getBirthPlace()), '<br />'; if ($person->isDead()) { - echo '<b>', i18n::fact_abbreviation('DEAT'), '</b> ', $person->getDeathDate()->Display(), ' ', PrintReady($person->getDeathPlace()); + echo '<b>', abbreviate_fact('DEAT'), '</b> ', $person->getDeathDate()->Display(), ' ', PrintReady($person->getDeathPlace()); } ?> </div> @@ -352,13 +352,13 @@ class TreeNav { <br /> <div class="details1 indent"> <?php - echo '<b>', i18n::fact_abbreviation('BIRT'), '</b> ', $spouse->getBirthDate()->Display(), ' ', PrintReady($spouse->getBirthPlace()), '<br />'; - echo '<b>', i18n::fact_abbreviation('MARR'), '</b> ', $family->getMarriageDate()->Display(), ' ', $family->getMarriagePlace(); + echo '<b>', abbreviate_fact('BIRT'), '</b> ', $spouse->getBirthDate()->Display(), ' ', PrintReady($spouse->getBirthPlace()), '<br />'; + echo '<b>', abbreviate_fact('MARR'), '</b> ', $family->getMarriageDate()->Display(), ' ', $family->getMarriagePlace(); ?> <a href="family.php?famid=<?php print $family->getXref(); ?>" onclick="if (!<?php print $this->name;?>.collapseBox) return false;"><img id="d_<?php print $family->getXref(); ?>" alt="<?php print $family->getXref(); ?>" class="draggable" src="<?php print $SERVER_URL.$WT_IMAGE_DIR."/".$WT_IMAGES['family']['button']; ?>" border="0" /></a><br /> <?php if ($spouse->isDead()) { - echo '<b>', i18n::fact_abbreviation('DEAT'), '</b> ', $spouse->getDeathDate()->Display(), ' ', PrintReady($spouse->getDeathPlace()), '<br />'; + echo '<b>', abbreviate_fact('DEAT'), '</b> ', $spouse->getDeathDate()->Display(), ' ', PrintReady($spouse->getDeathPlace()), '<br />'; } ?> </div> <?php diff --git a/includes/config_data.php b/includes/config_data.php index 8450a57b2d..010c816a89 100644 --- a/includes/config_data.php +++ b/includes/config_data.php @@ -1671,6 +1671,11 @@ $FACTS_F=array( '_NMR' =>i18n::translate_c('FEMALE', 'Not married'), ); +$FACT_ABBREV=array( + 'BIRT'=>i18n::translate_c('Abbreviation for birth', 'b.'), + 'MARR'=>i18n::translate_c('Abbreviation for marriage', 'm.'), + 'DEAT'=>i18n::translate_c('Abbreviation for death', 'd.'), +); // Create a label for a fact type. function translate_fact($fact, $person=null) { @@ -1693,3 +1698,14 @@ function translate_fact($fact, $person=null) { // Still no translation? Highlight this as an error return '<span class="error" title="'.i18n::translate('Unrecognized GEDCOM Code').'">'.$fact.'</span>'; } + +function abbreviate_fact($fact) { + global $FACT_ABBREV; + + if (array_key_exists($fact, $FACT_ABBREV)) { + return i18n::translate($FACT_ABBREV[$fact]); + } else { + // Just use the first letter of the full fact + return utf8_substr(translate_fact($fact), 0, 1).'.'; + } +} diff --git a/includes/controllers/lifespan_ctrl.php b/includes/controllers/lifespan_ctrl.php index 0c2696355c..ea98500657 100644 --- a/includes/controllers/lifespan_ctrl.php +++ b/includes/controllers/lifespan_ctrl.php @@ -490,19 +490,19 @@ class LifespanControllerRoot extends BaseController { $text = explode("-fact, ", $val); $fact = $text[0]; $val = $text[1]; - echo i18n::fact_abbreviation($fact); + echo abbreviate_fact($fact); echo "</b><span>", PrintReady($val), "</span></a></div>"; } $indiName = PrintReady(str_replace(array('<span class="starredname">', '</span>'), array('<u>', '</u>'), $value->getFullName())); echo "\n\t<table><tr>\n\t\t<td width=\"15\"><a class=\"showit\" href=\"#\"><b>"; - echo i18n::fact_abbreviation('BIRT'); + echo abbreviate_fact('BIRT'); echo "</b><span>", $value->getSexImage(), $indiName, "<br/>", i18n::translate('BIRT'), " ", strip_tags($bdate->Display(false)), " ", PrintReady($value->getBirthPlace()), "</span></a></td>" , "\n\t\t<td align=\"left\" width=\"100%\"><a href=\"", encode_url($value->getLinkUrl()), "\">", $value->getSexImage(), $indiName, ": $lifespan </a></td>" , "\n\t\t<td width=\"15\">"; if ($value->isDead()) { if ($deathReal || $value->isDead()) { print "<a class=\"showit\" href=\"#\"><b>"; - echo i18n::fact_abbreviation('DEAT'); + echo abbreviate_fact('DEAT'); if (!$deathReal) print "*"; print "</b><span>".$value->getSexImage().$indiName."<br/>".i18n::translate('DEAT')." ".strip_tags($ddate->Display(false))." ".PrintReady($value->getDeathPlace())."</span></a>"; } @@ -518,12 +518,12 @@ class LifespanControllerRoot extends BaseController { $text = explode("-fact,", $val); $fact = $text[0]; $val = $text[1]; - echo i18n::fact_abbreviation($fact); + echo abbreviate_fact($fact); print "</b><span>".PrintReady($val)."</span></a></div>"; } $indiName = PrintReady(str_replace(array('<span class="starredname">', '</span>'), array('<u>', '</u>'), $value->getFullName())); print "\n\t<table dir=\"ltr\"><tr>\n\t\t<td width=\"15\"><a class=\"showit\" href=\"#\"><b>"; - echo i18n::fact_abbreviation('BIRT'); + echo abbreviate_fact('BIRT'); if (!$birthReal) print "*"; print "</b><span>".$value->getSexImage().$indiName."<br/>".i18n::translate('BIRT')." ".strip_tags($bdate->Display(false))." ".PrintReady($value->getBirthPlace())."</span></a></td>" . "<td align=\"left\" width=\"100%\"><a href=\"".encode_url($value->getLinkUrl())."\">".$value->getSexImage().$indiName."</a></td>" . @@ -531,7 +531,7 @@ class LifespanControllerRoot extends BaseController { if ($value->isDead()) { if ($deathReal || $value->isDead()) { print "<a class=\"showit\" href=\"#\"><b>"; - echo i18n::fact_abbreviation('DEAT'); + echo abbreviate_fact('DEAT'); if (!$deathReal) print "*"; print "</b><span>".$value->getSexImage().$indiName."<br/>".i18n::translate('DEAT')." ".strip_tags($ddate->Display(false))." ".PrintReady($value->getDeathPlace())."</span></a>"; } @@ -543,7 +543,7 @@ class LifespanControllerRoot extends BaseController { $indiName = PrintReady(str_replace(array('<span class="starredname">', '</span>'), array('<u>', '</u>'), $value->getFullName())); print "<a class=\"showit\" href=\"".encode_url($value->getLinkUrl())."\"><b>"; - echo i18n::fact_abbreviation('BIRT'); + echo abbreviate_fact('BIRT'); print "</b><span>".$value->getSexImage().$indiName."<br/>".i18n::translate('BIRT')." ".strip_tags($bdate->Display(false))." ".PrintReady($value->getBirthPlace())."<br/>"; foreach($eventinformation as $evtwidth=>$val){ $text = explode("-fact,", $val); diff --git a/modules/GEDFact_assistant/_CENS/census_3_find.php b/modules/GEDFact_assistant/_CENS/census_3_find.php index 020d01ed54..d15c6eb2f9 100644 --- a/modules/GEDFact_assistant/_CENS/census_3_find.php +++ b/modules/GEDFact_assistant/_CENS/census_3_find.php @@ -526,7 +526,7 @@ if ($action=="filter") { echo "<b>".$indi->getFullName()."</b> "; // Name Link if ($ABBREVIATE_CHART_LABELS) { - $born=i18n::fact_abbreviation('BIRT'); + $born=abbreviate_fact('BIRT'); } else { $born=i18n::translate('BIRT'); } diff --git a/modules/GEDFact_assistant/_MEDIA/media_3_find.php b/modules/GEDFact_assistant/_MEDIA/media_3_find.php index 0bfb64e15c..aa21ca3a88 100644 --- a/modules/GEDFact_assistant/_MEDIA/media_3_find.php +++ b/modules/GEDFact_assistant/_MEDIA/media_3_find.php @@ -449,7 +449,7 @@ if ($action=="filter") { <b>".$indi->getFullName()."</b> "; if ($ABBREVIATE_CHART_LABELS) { - $born=i18n::fact_abbreviation('BIRT'); + $born=abbreviate_fact('BIRT'); } else { $born=i18n::translate('BIRT'); } |
