Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteXCStrings ¶
WriteXCStrings writes changes to the .xcstrings file
Types ¶
type ExtractionState ¶
type ExtractionState string
ExtractionState represents the state of the string extraction.
type Localization ¶
type Localization struct {
StringUnit *StringUnit `json:"stringUnit,omitempty"`
Variations *Variation `json:"variations,omitempty"`
}
Localization represents the localization data.
func (*Localization) AddPlural ¶
func (l *Localization) AddPlural(pluralType PluralType, loc Localization)
AddPlural adds or updates a plural variation for the specified PluralType.
func (*Localization) IsDevice ¶
func (l *Localization) IsDevice() bool
IsDevice checks if the Localization is a device variation.
func (*Localization) IsPlural ¶
func (l *Localization) IsPlural() bool
IsPlural checks if the Localization is a plural variation.
func (*Localization) MarshalJSON ¶
func (l *Localization) MarshalJSON() ([]byte, error)
MarshalJSON for Localization serializes stringUnit and variations.
func (*Localization) UnmarshalJSON ¶
func (l *Localization) UnmarshalJSON(data []byte) error
UnmarshalJSON for Localization handles stringUnit and variations.
type StringState ¶
type StringState string
StringState represents the translation state of a string.
type StringUnit ¶
type StringUnit struct {
State StringState `json:"state"`
Value string `json:"value"`
}
StringUnit represents the state and value of a localized string.
type Variation ¶
type Variation struct {
Plural map[PluralType]Localization `json:"plural,omitempty"`
Device map[DeviceType]Localization `json:"device,omitempty"`
}
Variation represents either plural or device-specific localizations.
func (*Variation) MarshalJSON ¶
MarshalJSON for Variation serializes plural and device-specific localizations.
func (*Variation) UnmarshalJSON ¶
UnmarshalJSON for Variation handles plural and device-specific localizations.
type VariationType ¶
type VariationType string
VariationType represents the type of variation (plural or device).
type XCString ¶
type XCString struct {
Comment *string `json:"comment,omitempty"`
Key *string `json:"key,omitempty"`
Localizations map[Language]Localization `json:"localizations"`
ExtractionState ExtractionState `json:"extractionState,omitempty"`
ShouldTranslate bool `json:"shouldTranslate"`
}
XCString represents a single localization entry.
func NewXCString ¶
func NewXCString(key string, comment *string, extractionState ExtractionState, shouldTranslate bool, localizations map[Language]Localization) *XCString
NewXCString creates a new XCString instance.
func (*XCString) GetComment ¶
GetComment retrieves the comment for the XCString. Returns the comment as a string. If no comment is set, returns an empty string.
func (*XCString) GetLocalization ¶
func (x *XCString) GetLocalization(language Language) (*Localization, bool)
GetLocalization retrieves a Localization by language from the XCString structure. Returns the Localization and a boolean indicating if the language was found.
func (*XCString) MarshalJSON ¶
MarshalJSON for XCString converts the map of Language to localizations.
func (*XCString) UnmarshalJSON ¶
UnmarshalJSON for XCString converts localizations into the map of Language.