[icinga-checkins] icinga.org: icingaweb2/feature/translation-catalog-object-13012: CatatlogEntry: Rename splitStringAtCharLimit to reformatAttributeString
git at icinga.org
git at icinga.org
Tue Nov 22 09:50:38 CET 2016
Module: icingaweb2
Branch: feature/translation-catalog-object-13012
Commit: 61ca6b85f9256fcb07216b30a687f5ad4d0c7929
URL: https://git.icinga.org/?p=icingaweb2.git;a=commit;h=61ca6b85f9256fcb07216b30a687f5ad4d0c7929
Author: Noah Hilverling <noah.hilverling at netways.de>
Date: Tue Nov 22 09:50:08 2016 +0100
CatatlogEntry: Rename splitStringAtCharLimit to reformatAttributeString
---
.../library/Translation/Catalog/CatalogEntry.php | 37 +++++++++++++-------
1 file changed, 24 insertions(+), 13 deletions(-)
diff --git a/modules/translation/library/Translation/Catalog/CatalogEntry.php b/modules/translation/library/Translation/Catalog/CatalogEntry.php
index 63a17b5..45eed2b 100644
--- a/modules/translation/library/Translation/Catalog/CatalogEntry.php
+++ b/modules/translation/library/Translation/Catalog/CatalogEntry.php
@@ -573,7 +573,8 @@ class CatalogEntry
$entryArray = array_merge(
$entryArray,
$this->splitStringAtCharLimit(
- '#| msgctxt "' . $this->escapeChars($this->previousMessageContext) . '"',
+ '#| msgctxt',
+ $this->escapeChars($this->previousMessageContext),
true
)
);
@@ -583,7 +584,8 @@ class CatalogEntry
$entryArray = array_merge(
$entryArray,
$this->splitStringAtCharLimit(
- '#| msgid "' . $this->escapeCharacters($this->previousMessageId) . '"',
+ '#| msgid',
+ $this->escapeCharacters($this->previousMessageId),
true
)
);
@@ -593,7 +595,8 @@ class CatalogEntry
$entryArray = array_merge(
$entryArray,
$this->splitStringAtCharLimit(
- '#| msgid_plural "' . $this->escapeCharacters($this->previousMessageIdPlural) . '"',
+ '#| msgid_plural',
+ $this->escapeCharacters($this->previousMessageIdPlural),
true
)
);
@@ -603,7 +606,8 @@ class CatalogEntry
$entryArray = array_merge(
$entryArray,
$this->splitStringAtCharLimit(
- 'msgctxt "' . $this->escapeCharacters($this->messageContext) . '"'
+ 'msgctxt',
+ $this->escapeCharacters($this->messageContext)
)
);
}
@@ -612,7 +616,8 @@ class CatalogEntry
$entryArray = array_merge(
$entryArray,
$this->splitStringAtCharLimit(
- 'msgid "' . $this->escapeCharacters($this->messageId) . '"'
+ 'msgid',
+ $this->escapeCharacters($this->messageId)
)
);
}
@@ -621,7 +626,8 @@ class CatalogEntry
$entryArray = array_merge(
$entryArray,
$this->splitStringAtCharLimit(
- 'msgid_plural "' . $this->escapeCharacters($this->messageIdPlural) . '"'
+ 'msgid_plural',
+ $this->escapeCharacters($this->messageIdPlural)
)
);
}
@@ -630,7 +636,8 @@ class CatalogEntry
$entryArray = array_merge(
$entryArray,
$this->splitStringAtCharLimit(
- 'msgstr "' . $this->escapeCharacters($this->message) . '"'
+ 'msgstr',
+ $this->escapeCharacters($this->message)
)
);
}
@@ -640,7 +647,10 @@ class CatalogEntry
{
$entryArray = array_merge(
$entryArray,
- $this->splitStringAtCharLimit('msgstr[' . $key . '] ' . '"' . $value . '"')
+ $this->splitStringAtCharLimit(
+ 'msgstr[' . $key . ']',
+ $value
+ )
);
}
}
@@ -649,14 +659,15 @@ class CatalogEntry
}
/**
- * Split a string into lines at char limit
+ * Reformat the given string to fit line length limitation and .po format
*
- * @param string $string The string to split
- * @param bool $isPrevious Whether given string is marked previous
+ * @param string $attributePrefix The attribute prefix that will be placed in front of the string
+ * @param string $string The string to split
+ * @param bool $isPrevious Whether given string is marked previous
*
- * @return array Returns an array of split lines
+ * @return array Returns an array of split lines
*/
- public function splitStringAtCharLimit($string, $isPrevious = false)
+ public function reformatAttributeString($attributePrefix, $string, $isPrevious = false)
{
if (strlen($string) <= self::MAX_LINE_LENGTH) {
return array($string);
More information about the icinga-checkins
mailing list