Class StringCatParser
Parser for Apple String Catalog files (.xcstrings). A single .xcstrings file contains translations for all locales in the format: strings → key → localizations → lang → stringUnit → value.
public class StringCatParser : BaseJsonParser
- Inheritance
-
StringCatParser
- Inherited Members
Properties
TextProcessingMode
Gets or sets the text processing mode used when recognising placeholder strings.
public static TextFormat TextProcessingMode { get; set; }
Property Value
Methods
CanHandleExtension(string)
Checks whether this parser can handle a translation file with the given extension.
This method is not used for configuration files.
public override bool CanHandleExtension(string fileExtension)
Parameters
fileExtensionstringThe extension to check.
Returns
GetTextProcessingMode()
Used for internal needs.
protected override TextFormat GetTextProcessingMode()
Returns
- TextFormat
The effective text processing mode.
InternalLoadTranslationEntriesFromJSON(JsonElement, Translation?, string, TextFormat?)
protected override Translation InternalLoadTranslationEntriesFromJSON(JsonElement jsonObj, Translation? translation, string groupName, TextFormat? textProcessingMode)
Parameters
jsonObjJsonElementtranslationTranslationgroupNamestringtextProcessingModeTextFormat?
Returns
InternalLoadTranslationStructure(string, TextFormat?)
Loads the keys from the default translation file and builds a tree of keys.
protected override TranslationTree? InternalLoadTranslationStructure(string content, TextFormat? textProcessingMode)
Parameters
contentstringThe content to parse.
textProcessingModeTextFormat?The mode of processing of the text of the default file.
Returns
- TranslationTree
The constructed TranslationTree upon success or null otherwise.
Exceptions
- TextParseException
Gets thrown when parsing of a default translation file fails.
LoadTranslation(string, CultureInfo?, TextFormat?)
Loads the translation information from the file and returns a translation.
public override Translation? LoadTranslation(string translationText, CultureInfo? culture, TextFormat? textProcessingMode)
Parameters
translationTextstringThe text of the file to load.
cultureCultureInfoAn optional reference to the locale, whose translation is to be loaded. Makes sense for CSV and TSV formats that may contain multiple translations in one file.
textProcessingModeTextFormat?The mode of processing of the text of the translation file.
Returns
- Translation
The loaded translation or null if loading failed.
LoadTranslationWithLocations(string, CultureInfo?, TextFormat?)
Parses the translation using a streaming JSON reader that captures exact key positions. Called when PopulateKeyLocations is true.
protected override Translation? LoadTranslationWithLocations(string translationText, CultureInfo? culture, TextFormat? textProcessingMode)
Parameters
translationTextstringcultureCultureInfotextProcessingModeTextFormat?
Returns
Use()
Initializes the parser class, making it available for use.
public static void Use()