Documentation ¶
Overview ¶
Package xml specifies functions and structs for writing dictionaries to xml files and android project res folder
Index ¶
Constants ¶
View Source
const ( // ValuesPrefix defines the default prefix for values folder ValuesPrefix = "values-" // StringsFilename defines the default filename for android string constants file StringsFilename = "strings.xml" // ExportFileMode defines the default permissions for created file ExportFileMode = 0750 )
Variables ¶
This section is empty.
Functions ¶
func ReadResFolder ¶
func ReadResFolder(path string) (dicts general.Dictionaries, err error)
ReadResFolder reads and unmarshals all strings.xml files in the "res" folder
func WriteResFolder ¶
WriteResFolder writes the given set of dictionaries to the res folder at the given path
Types ¶
type ResourcesEntry ¶
type ResourcesEntry struct { XMLName xml.Name `xml:"resources"` // name of xml tag Strings []StringEntry `xml:"string"` // strings itself }
ResourcesEntry struct defines a node of <resources></resources> tag in xml file
func ReadXMLFile ¶
func ReadXMLFile(path string) (r *ResourcesEntry, err error)
ReadXMLFile unmarshals structure of strings.xml file and returns its content
func (*ResourcesEntry) ConvertToDictionary ¶
func (r *ResourcesEntry) ConvertToDictionary() (d general.Dictionary)
ConvertToDictionary converts the given ResourcesEntry to the dictionary map[code]translation
func (*ResourcesEntry) WriteToXMLFile ¶
func (r *ResourcesEntry) WriteToXMLFile(path string) (file *os.File, err error)
WriteToXMLFile marshals and writes xml structure of ResourcesEntry to the specified file
Click to show internal directories.
Click to hide internal directories.