i18n Resource File Formats: ini files
This time among all the resource file formats that are common in software localization we're looking at ini files. Some other formats are explained in separate blog posts.
.ini files are commonly used in applications on various platforms. There is no standard for ini files, and the applications can vary in their use of key-value delimiters, comment masks, comment positions, sections nesting, support for blank lines...
When using .ini files, lingohub expects that:
- key-value pairs are delimited with the equal character (=) or colon (:), and terminated by a new line
- values can not spread to multiple lines.
- section declarations can have this form: [section]
- all keys after the section declaration are associated with that section
- there is no explicit "end of section" delimiter and sections end on next section declaration or at the end of file
- sections can not be nested
- place-holders are not supported
- comment lines can start with hash (#) or semicolon (;), and everything up to the end of the line is treated as a comment
- comment is assigned to the next key-value pair unless there are any blank lines or section declarations in between
.ini file example with comments
; this comment is ignored because it is not directly followed by a key-value pairComment below if you have any general questions on resource file formats, ini or other.
; this comment is also ignored because it is followed by a section [section1]
; comments in .ini files can start with hash hello_user = Hello stranger!
[section2] ; this key belongs to section2 and no longer to section1 welcome_message = Welcome back, we have missed you
; multi line comments belong to the next key value pair ; as long as they are not interrupted by a white line visit_count = this is your millionth visit to our site