Skip to content

Commit 36dc005

Browse files
authored
fix: loading translations via changed date (#44)
When using the units API and getting the translations via `"changed:>=YYYY-MM-DD"` you will not get all translations wanted. Translations which were only once touched get only an added date. So, those translations will not be fetched. This changes query for the `changed` and `added` fields to fix this. Fixes #43
1 parent a5c7ecb commit 36dc005

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/at/porscheinformatik/weblate/spring/WeblateMessageSource.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,11 @@ private static String formatTimestampIso(long timestamp) {
287287
}
288288

289289
private void loadTranslation(String code, Properties properties, long timestamp) {
290-
String currentQuery = query + " AND changed:>=" + formatTimestampIso(timestamp);
290+
String currentQuery = query;
291+
if (timestamp > 0L) {
292+
String timestampStr = formatTimestampIso(timestamp);
293+
currentQuery += " AND (added:>=" + timestampStr + " OR changed:>=" + timestampStr + ")";
294+
}
291295

292296
try {
293297
RequestEntity<Void> request = RequestEntity

0 commit comments

Comments
 (0)