Documentation
¶
Overview ¶
Package propfile implements reading and writing of Java .properties files.
Format: key=value pairs, one per line. Lines starting with '#' or '!' are comments and are preserved verbatim in the output. Blank lines are also preserved. Multi-line values (backslash continuation) are not supported — each line is treated independently.
File naming convention: each language is stored as a separate file:
translations_dir/en.properties (source) translations_dir/ru.properties (translation)
The File type maintains the original line order so that round-trip serialization reproduces the source structure with translated values.
Index ¶
- func SyncKeys(src, target *File)
- type File
- func (f *File) Get(key string) (string, bool)
- func (f *File) Keys() []string
- func (f *File) Marshal() ([]byte, error)
- func (f *File) Set(key, value string) bool
- func (f *File) SourceValues() map[string]string
- func (f *File) Stats() (int, int, float64)
- func (f *File) UntranslatedKeys() []string
- func (f *File) WriteFile(path string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
File represents a parsed .properties file.
func NewTranslationFile ¶
NewTranslationFile creates an empty target File mirroring src's structure with all values cleared.
func (*File) Set ¶
Set sets the value for an existing key. Returns true on success, false if the key does not exist.
func (*File) SourceValues ¶
SourceValues returns a map of key → value for use as translation source.
func (*File) UntranslatedKeys ¶
UntranslatedKeys returns keys whose value is empty.