Eints is entirely built as web service, which is great for interactively handling translated strings. However, sometimes it is useful to do the same operations in batch from the command line or from a script.
For this purpose, the lang_sync program exists. Like the Eints service, it is written in Python 3. It can
It operates by programmatically accessing the Eints service.
For its operations, lang_sync needs a lot of information, which is provided through option values. While technically you can run the program manually from the command line, but the number of option values is so large that wrapping the execution in a script is useful.
The general options are
Get the online help text.
Show what the program is doing
Don’t make actual changes to any file
Getting access to the Eints web application is useful to get anything done. Basically it needs to get the user name and password, which can be given in a number of different ways
If given, FILE contains lines of the form:
username: <username>
password: <password>
with <username> the actual user name, and <password> the actual password. If needed, quotes may be used around the user name or password.
If the file was not provided, or did not contain a user name, specifying the user name at the command-line is a second solution. At multi-user systems, this is however not secure, everybody can query the application parameters while the program is running.
If no file is given, or it did not contain a password, specifying the password at the command line is another (but not so good) solution.
At a multi-user system this is not secure, and should be avoided.
The last option to get the user name and password is using the standard Python getpass module. This will ask for the password at the command-line. This option prevents use of this module, so lang_sync will not become stuck at waiting for user input.
The scheme and host part of the Eints service URL. Typically a string like:
https://eints.example.com/
The other important part is the project that is accessed. Depending on the performed operations, some options may be omitted. Adding options that are not used is however allowed.
Name of the project in Eints (may contain letters, digits, and dashes).
Type of project in Eints, needed to create the project. Accepted values are “game-script” and “newgrf”.
For project creation, a longer title of the project (may contain letters, digits, dashes and spaces).
For project creation, an optional website URL.
For uploading or downloading language files, the path of the directory containing the language files at the local disc. (Default: lang.)
For uploading or downloading language files, the filename suffix used by the language files. (Default: .lng.)
For uploading or downloading language files, in case Eints does not know the base language (mostly at initial import), this option can be used to specify it manually. It must be the same number as given at a ##grflangid line (a string of the form 0x[HEX][HEX].)
When downloading new languages, the program creates new language files. It has a list of well-known language base filenames, but for unknown languages or when the default base filename is not good, this option can be used to override the default.
Lines of the files should have the form:
0x[HEX][HEX]: <base-filename>
Line comments start with a #, and empty lines are silently ignored.
The actual operations that should be performed by the script are given as command-line arguments after the options. Currently, five operations are supported:
You can add several operations at the command line, they are executed sequentially.
There are a few restrictions to consider. You cannot upload or download before having created the project, and upload after download is useless, since the download will overwrite the local language files.