Fasi7 is a command-line interface (CLI) tool designed to help developers translate their localization files using AI. It automates the process of translating content from one language to multiple target languages, preserving placeholders and adapting to the context of your business.
Download the latest release from the releases page
Fasi7 uses a configuration file to store settings. By default, it looks for a file named .fasi7.yaml
in the current directory.
To create a new configuration file, run:
fasi7 init
The following options can be set in the configuration file:
openai.apiKey
: Your OpenAI API keyopenai.model
: The OpenAI model to use for translationsopenai.systemPrompt
: Custom system prompt for the AI (optional)outputLocales
: List of target locales for translationinputLocale
: The source locale to translate frombusinessDescription
: A description of your business to provide context for translationsdir
: The directory containing localization filesignoreFilesWithContent
: (Optional) If specified, files containing this string will be ignored
To run Fasi7 and translate your localization files:
fasi7
This command will:
- Read the configuration file
- Recursively search for files in the specified directory
- Identify files matching the input locale
- Translate the content to each specified output locale
- Write the translated content to new files, preserving the directory structure
--config
: Specify a custom path for the configuration file (default:.fasi7.yaml
)
Example:
fasi7 --config /path/to/custom/config.yaml
- Fasi7 uses the OpenAI API to perform translations.
- It sends each file's content to the AI along with a system prompt that includes:
- The source and target languages
- Instructions to preserve placeholders
- Your business description for context
- The AI generates a translation, which is then saved to a new file in the appropriate locale directory.
Fasi7 will exit with an error message in the following cases:
- No configuration file found
- Missing required configuration options
- File read/write errors
- OpenAI API errors
Fasi7 translates files concurrently to improve performance when dealing with multiple output locales or many files.
- Provide a detailed business description in your configuration to improve translation accuracy and context.
- Use meaningful placeholder names in your localization files to ensure they are correctly preserved.
- Choose an appropriate model for your needs.
- Fasi7 relies on the OpenAI API, which may have usage limits and costs associated with it.
- The quality of translations depends on the AI model used and the context provided.
- It works with all the file structures, but the iso code has to be in the folder name not in the file name, as it works in this simple tasks
- Read all the not ignored files in the directory
- translate the content of the file
- write it to the same path with replacing the /[input iso code]/ with /[output iso code]/
Contributions are welcome! Please submit issues or pull requests to help improve Fasi7.
MIT License