WeblateOrg / WeblateOrg/weblate

Regex based generic file format

Open
#2,978 7 comments 0 reactions 0 assignees View on GitHub
Blocked by upstream enhancement Waiting for: Demand
Dominant language
Python
Stars
6.1k
Forks
1.4k
Avg merge
9h 53m
Merged PRs (30d)
395

Description

**My problem**
I'm starting to use weblate to improve translating in an open source android app I maintain.
It works great for the standard strings (thanks!) but there's also a couple of other kinds of files I'd like to support:
* `string-xyz.txt`; A number of monolingual plain text files where each line is a separate sentence requiring translation
* Android string arrays; I've seen these are a known issue with a reference based workaround, however there are a lot of arrays in the app and breaking them all out will be unpleasant and harder to maintain.

**Describe the solution you'd like**
A file format handler that takes a custom regex string to parse out each of the strings.
Something like this could be used to cover both these, and many other file formats.

My idea comes from the regex matcher already used by the Component discovery addon, but for file contents rather than file names. It could have a couple of named regex groups to specify context (if it exists) and source string. Basically each match is a new string.

If context doesn't exist in the file in question it means each language file would need to match the source structure exactly, but I guess this would be the case for any such file format anyway.

**Describe alternatives you've considered**
Alternatively, I convert all my plain text files to json, then build a new file reader in the app to handle the json files instead of the plain text files.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.