WeblateOrg / WeblateOrg/weblate

Add regex support for replacements flag

Open
#15,777 0 comments 1 reaction 0 assignees View on GitHub
Area: Quality checks Waiting for: Demand
Dominant language
Python
Stars
6.1k
Forks
1.4k
Avg merge
9h 29m
Merged PRs (30d)
408

Description

### Describe the problem

Since regex support is provided for placeholders flag, it should also be available for replacements flag becasue sometimes there are many variables that have the same length when rendered in the game and defining a replacement for all of them is not possible.

For example in my use case the software uses custom special characters to show icons or text formatting (zero size). It should be possible to define a regex pattern for a group of variables that have the same size and use one example of the final value of these as replacement value.

### Solution brainstorm

The same approach used for placeholders can easily be copied for replacements flag to be able to have the r"REGEX" format.

### Describe alternatives you have considered

_No response_

### Screenshots

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by locating the existing regex handling for the placeholders flag and compare it with how the replacements flag is parsed. Trace the r"REGEX" format through the relevant entry point, then add coverage for regex-based replacements. Done means a regex can select multiple same-length variables while using one replacement value, without changing existing placeholder behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
localization
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.