### Install FTL-Extract with UV Source: https://github.com/andrew000/ftl-extract/blob/dev/README.md Use UV, a modern package installer, to add FTL-Extract as a development dependency. ```shell $ uv add --dev FTL-Extract ``` -------------------------------- ### Install FTL-Extract with pip Source: https://github.com/andrew000/ftl-extract/blob/dev/README.md Use pip to install the FTL-Extract package. ```shell $ pip install FTL-Extract ``` -------------------------------- ### Comprehensive FTL Extract Configuration Source: https://github.com/andrew000/ftl-extract/blob/dev/README.md A detailed example of FTL Extract usage, including source and locale paths, multiple languages, key filtering, ignore patterns, keyword arguments, comment handling, caching, and verbose output. ```shell $ ftl extract \ 'app/bot' \ 'app/bot/locales' \ -l 'en' \ -l 'uk' \ -K 'LF' \ -I 'core' \ -E './tests/*' \ --ignore-kwargs 'when' \ --comment-junks \ --comment-keys-mode 'comment' \ --cache \ --verbose ``` -------------------------------- ### Generate FTL config sample Source: https://github.com/andrew000/ftl-extract/blob/dev/README.md Print a sample configuration for FTL-Extract, optionally for a specific command. ```shell $ ftl config sample $ ftl config sample --command extract ``` -------------------------------- ### Create locales directory Source: https://github.com/andrew000/ftl-extract/blob/dev/README.md Before extracting keys, create a 'locales' directory in your project. ```shell $ mkdir project_path/locales ``` -------------------------------- ### Specify configuration file with --config Source: https://github.com/andrew000/ftl-extract/blob/dev/README.md Use the --config flag to specify a pyproject.toml file when it's not in the current directory. ```shell $ ftl --config ./pyproject.toml extract ``` -------------------------------- ### Configure FTL-Extract in pyproject.toml Source: https://github.com/andrew000/ftl-extract/blob/dev/README.md Configure FTL-Extract settings, including paths, languages, and ignore rules, within the [tool.ftl-extract] section of pyproject.toml. ```toml [tool.ftl-extract.extract] code-path = "project_path/code_path" locales-path = "project_path/locales" languages = ["en", "uk"] i18n-keys-append = ["LF", "LazyProxy"] ignore-attributes-append = ["core"] exclude-dirs-append = ["./tests/*"] ignore-kwargs = ["when"] comment-junks = true comment-keys-mode = "comment" line-endings = "lf" cache = true [tool.ftl-extract.stub] locales-path = "project_path/locales/en" stub-path = "project_path/code_path/stub.pyi" export-tree = false [tool.ftl-extract.check] locales-path = "project_path/locales" code-path = "project_path/code_path" languages = ["uk"] checks = ["all"] suggest-from = ["en"] fail-on = ["error"] report-path = "reports/ftl-check" report-format = "json" ``` -------------------------------- ### Add Multiple Languages to Project Source: https://github.com/andrew000/ftl-extract/blob/dev/README.md Extracts localization files and adds support for multiple languages (English, Ukrainian, and Polish) to the project. Specify the code path and locales path, and use the -l flag for each language. ```shell # Here we add 3 languages: English, Ukrainian and Polish $ ftl extract project_path/code_path project_path/locales -l en -l uk -l pl ``` -------------------------------- ### Run FTL commands with pyproject.toml configuration Source: https://github.com/andrew000/ftl-extract/blob/dev/README.md Execute FTL commands like 'extract', 'stub', and 'check' without repeating configured paths when using pyproject.toml. ```shell $ ftl extract $ ftl stub $ ftl check ``` -------------------------------- ### Specify FTL file path in i18n calls Source: https://github.com/andrew000/ftl-extract/blob/dev/README.md Use the '_path' keyword argument in i18n calls to direct keys to specific .ftl files. ```python # Before i18n.get("key-1", arg1="value1", arg2="value2") # After i18n.get("key-1", arg1="value1", arg2="value2", _path="dir/ftl_file.ftl") # Also i18n.key_1(arg1="value1", arg2="value2", _path="dir/ftl_file.ftl") # Or i18n.some.key_1(arg1="value1", arg2="value2", _path="dir/ftl_file.ftl") ``` -------------------------------- ### FTL Check Configuration: All Checks Source: https://github.com/andrew000/ftl-extract/blob/dev/README.md Configure FTL extract to run all available checks. This includes syntax, untranslated, missing, stale, and kwargs checks. Requires locales path, code path, and specified languages. ```toml [tool.ftl-extract.check] locales-path = "app/bot/locales" code-path = "app/bot" languages = ["uk", "pl"] checks = ["all"] suggest-from = ["en"] fail-on = ["error"] report-path = "reports/ftl-check" report-format = "json" ``` -------------------------------- ### FTL Check Configuration: Keyword Arguments Source: https://github.com/andrew000/ftl-extract/blob/dev/README.md Configure FTL extract to check Python keyword arguments against Fluent variables. This configuration requires both the locales path and code path, along with specified languages. ```toml [tool.ftl-extract.check] locales-path = "app/bot/locales" code-path = "app/bot" languages = ["uk", "pl"] checks = ["kwargs"] fail-on = ["error"] report-format = "terminal" ``` -------------------------------- ### Generate Stub File Source: https://github.com/andrew000/ftl-extract/blob/dev/README.md Generates a stub file for type checking. Specify the path to your locales directory and the desired output path for the stub file. ```shell $ ftl stub 'project_path/locales/' 'project_path/code_path' ``` -------------------------------- ### Check Localization Files Source: https://github.com/andrew000/ftl-extract/blob/dev/README.md Performs various checks on your localization files. This command requires the path to your locales directory and optionally accepts code path, specific languages, and suggestion sources. ```shell $ ftl check project_path/locales --code-path project_path/code_path -l uk --suggest-from en ``` -------------------------------- ### FTL Check Configuration: References Source: https://github.com/andrew000/ftl-extract/blob/dev/README.md Configure FTL extract to check only for missing message and term references within Fluent files. This configuration requires the locales path and specified languages, but not the code path. ```toml [tool.ftl-extract.check] locales-path = "app/bot/locales" languages = ["uk", "pl"] checks = ["references"] fail-on = ["error"] report-format = "terminal" ``` -------------------------------- ### FTL Check Configuration: Missing References Source: https://github.com/andrew000/ftl-extract/blob/dev/README.md Configure FTL extract to check for keys used in Python code but missing from locale files. This configuration requires both the locales path and code path, along with specified languages. ```toml [tool.ftl-extract.check] locales-path = "app/bot/locales" code-path = "app/bot" languages = ["uk", "pl"] checks = ["missing"] suggest-from = ["en"] fail-on = ["error"] report-format = "terminal" ``` -------------------------------- ### FTL Check Configuration: Syntax Errors Source: https://github.com/andrew000/ftl-extract/blob/dev/README.md Configure FTL extract to check only for Fluent syntax errors. This configuration requires the locales path and specified languages, but not the code path. ```toml [tool.ftl-extract.check] locales-path = "app/bot/locales" languages = ["uk", "pl"] checks = ["syntax"] fail-on = ["error"] report-format = "terminal" ``` -------------------------------- ### FTL Check Configuration: Custom Subset Source: https://github.com/andrew000/ftl-extract/blob/dev/README.md Configure FTL extract to run a custom subset of checks, including syntax, references, missing, and kwargs. This requires locales path, code path, specified languages, and suggestion sources. ```toml [tool.ftl-extract.check] locales-path = "app/bot/locales" code-path = "app/bot" languages = ["uk", "pl"] checks = ["syntax", "references", "missing", "kwargs"] suggest-from = ["en"] fail-on = ["error"] report-path = "reports/ftl-check" report-format = "json" ``` -------------------------------- ### Extract FTL Keys with Specific Keys Source: https://github.com/andrew000/ftl-extract/blob/dev/README.md Extracts FTL keys from specified code and locale paths, targeting specific keys like 'LF', 'LazyProxy', and 'L'. ```shell $ ftl extract project_path/code_path project_path/locales -K LF -K LazyProxy -K L ``` -------------------------------- ### Extract keys from code Source: https://github.com/andrew000/ftl-extract/blob/dev/README.md Use the ftl extract command to extract translation keys from specified code and locales paths. ```shell $ ftl extract project_path/code_path project_path/locales ``` -------------------------------- ### Ignore Untranslated Placeholder Source: https://github.com/andrew000/ftl-extract/blob/dev/README.md Adds a comment marker to skip a key from the `ftl check --check untranslated` check. This is useful for intentionally identical keys like brand or domain terms. ```ftl # ftl-extract: ignore-untranslated balance = balance ``` -------------------------------- ### FTL Extract command additional arguments Source: https://github.com/andrew000/ftl-extract/blob/dev/README.md List of additional arguments for the 'ftl extract' command, including language, exclusion, and cache options. ```shell -l or --language - add a new language to the project. -k or --i18n-keys - add additional i18n keys to the extractor. -K or --i18n-keys-append - add additional i18n keys to the extractor and append them to the default list. -p or --i18n-keys-prefix - add a prefix to the i18n keys. For example, self.i18n.-v.bin. --cache-path - custom cache directory or file path. Directory paths store the cache as extract--v.bin. Passing this option enables the cache. --clear-cache - delete the existing extraction cache before running. ``` -------------------------------- ### FTL Check Configuration: Untranslated Source: https://github.com/andrew000/ftl-extract/blob/dev/README.md Configure FTL extract to check only for untranslated placeholders. This configuration requires the locales path and specified languages, but not the code path. ```toml [tool.ftl-extract.check] locales-path = "app/bot/locales" languages = ["uk", "pl"] checks = ["untranslated"] suggest-from = ["en"] fail-on = ["error"] report-format = "terminal" ``` -------------------------------- ### FTL Check Configuration: Stale Messages Source: https://github.com/andrew000/ftl-extract/blob/dev/README.md Configure FTL extract to check for stale Fluent messages that are not used by Python code. This configuration requires both the locales path and code path, along with specified languages. ```toml [tool.ftl-extract.check] locales-path = "app/bot/locales" code-path = "app/bot" languages = ["uk", "pl"] checks = ["stale"] fail-on = ["error"] report-format = "terminal" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.