Skip to content

Commit

Permalink
Fix small code and spell issues
Browse files Browse the repository at this point in the history
  • Loading branch information
derkoe committed Dec 7, 2022
1 parent 5247c5b commit b9d46c4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ customization of the HTTP calls you can set your own `RestTemplate`.
## Caching

`WeblateMessageSource` caches loaded translations 30 minutes (this can be changed by setting `maxAgeMilis`).
If you want to update one locale immediatly call `WeblateMessageSource#reload(Locale)`.
If you want to update one locale immediately call `WeblateMessageSource#reload(Locale)`.

If you want to fully clear the cache call `WeblateMessageSource#clearCache` - this will also reload the languages. **Please use this with caution as it add heavy load to the Weblate API!**
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public void clearCache() {
public void reload(Locale... locales) {
logger.info("Going to reload the translations ...");

if (locales != null && locales.length > 0) {
if (locales != null) {
for (Locale locale : locales) {
logger.info(String.format("Reload translation for locale %s", locale));
loadTranslations(locale, true);
Expand Down Expand Up @@ -512,7 +512,7 @@ class Unit {

class CacheEntry {
public final Properties properties;
public long timestamp;
public final long timestamp;

public CacheEntry(Properties properties, long timestamp) {
this.properties = properties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus;

import java.net.URISyntaxException;
import java.util.Locale;
import java.util.Properties;

Expand Down Expand Up @@ -40,7 +39,7 @@ class WeblateMessageSourceTest {
private static final String RESPONSE_PAGING = "{\"count\":2,\"next\":\"http://localhost:8080/api/translations/test-project/test-comp/en/units/?page=1&q=state%3A%3E%3Dtranslated\",\"previous\":null,\"results\":[]}";
private static final String RESPONSE_EMPTY = "{\"count\":0,\"next\":null,\"previous\":null,\"results\":[]}";

private RestTemplate restTemplate = new RestTemplate();
private final RestTemplate restTemplate = new RestTemplate();

private WeblateMessageSource messageSource;

Expand Down Expand Up @@ -108,7 +107,7 @@ void simpleCase() {
}

@Test
void emptyResponse() throws URISyntaxException {
void emptyResponse() {
mockGetLocales();
mockResponse(RESPONSE_EMPTY);

Expand Down

0 comments on commit b9d46c4

Please sign in to comment.