Commit 847d44a
Konstantinos Bairaktaris
Make language mappings deterministic
Consider this scenario: Someone has in their config file:
```ini
[main]
lang_map = it: it-IT
[RESOURCE_ID]
lang_map = it: it_IT
```
Before we created a local-to-remote map that looked like this:
```json
{"it-IT": "it", "it_IT", "it"}
```
And then, to create the remote-to-local map, we reversed it. The problem
was that, since both values are the same, the key that ended up being
selected was random, so it could either be:
```json
{"it": "it-IT"}
```
or
```json
{"it": "it_IT"}
```
To fix the issue, we now create remote-to-local first, going over the
global configuration first and the resource-level configuration second
so that the resource-level will prevail and thus take preference, and
then we create the local-to-remote by reversing. So,
First, we will consume the global configuration:
```json
{"it": "it-IT"}
```
Then, as the resource-level configuration is consumed, it will replace
the old key:
```json
{"it": "it_IT"}
```
And then, the local-to-remote will end up being:
```json
{"it_IT": "it"}
```
This is the deterministic and the intended behaviour, since
resource-level configuration should take precedence.1 parent 8f4f7ef commit 847d44a
3 files changed
+17
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
| 172 | + | |
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
177 | | - | |
178 | | - | |
| 176 | + | |
179 | 177 | | |
180 | 178 | | |
181 | 179 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
493 | 493 | | |
494 | 494 | | |
495 | 495 | | |
496 | | - | |
497 | | - | |
498 | | - | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
499 | 501 | | |
500 | 502 | | |
501 | 503 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
| 127 | + | |
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
137 | | - | |
| 136 | + | |
| 137 | + | |
138 | 138 | | |
139 | | - | |
| 139 | + | |
140 | 140 | | |
141 | | - | |
| 141 | + | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
152 | 150 | | |
153 | | - | |
| 151 | + | |
154 | 152 | | |
155 | 153 | | |
156 | 154 | | |
| |||
0 commit comments