Skip to content

Commit

Permalink
Release 1.2.7 (#159)
Browse files Browse the repository at this point in the history
* Enhanced i18n sabi-17 (#158)
  • Loading branch information
StefanSchubert authored Mar 3, 2024
1 parent 405fba2 commit 60a4e69
Show file tree
Hide file tree
Showing 47 changed files with 747 additions and 147 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# History of changes (since 5/2022)

## Release 1.2.7

### Feature
* SABI-17: i18n of measurement units, parameter and plagues.

## Release 1.2.6

### Enhancements
Expand Down
9 changes: 9 additions & 0 deletions captcha/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<springdoc.openapiv2.version>2.3.0</springdoc.openapiv2.version>
<micrometer.prometheus.version>1.12.3</micrometer.prometheus.version>
<lombok.version>1.18.30</lombok.version>
<owasp.plugin.version>9.0.9</owasp.plugin.version>
<maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
<versions.maven.plugin.version>2.16.2</versions.maven.plugin.version>
Expand Down Expand Up @@ -106,6 +107,14 @@
<version>${springdoc.openapiv2.version}</version>
</dependency>

<!-- Common Stuff -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>

<!-- Test dependencies, since SB3.x junit5 is default -->
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
Expand All @@ -26,6 +27,7 @@
*/
@RestController
@RequestMapping(value = "api/")
@Slf4j
public class CaptchaController {

@Autowired
Expand All @@ -46,9 +48,11 @@ public ResponseEntity<ChallengeTo> getNewCaptchaChallenge(
@PathVariable(value = "language", required = true)
@Parameter(name = "language", description = "ISO-639-1 language code - used for i18n in communication. English will be used as fallback, if language is not available.") String language) {

log.debug("Received new challenge request for langcode {}", language);
ResponseEntity<ChallengeTo> response;

if (ChallengeRequestThrottle.requestAllowed()) {
log.debug("Request passed throttle barrier");
ChallengeTo challengeTo = generator.provideChallengeFor(language);
response = new ResponseEntity<>(challengeTo, HttpStatus.OK);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package de.bluewhale.captcha.service;

import de.bluewhale.captcha.model.ChallengeTo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.*;
Expand All @@ -27,6 +28,7 @@
* @author Stefan Schubert
*/
@Service
@Slf4j
public class QAGenerator {
private static final int TOKEN_SIZE = 5;
// ------------------------------ FIELDS ------------------------------
Expand Down
10 changes: 0 additions & 10 deletions captcha/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,3 @@ spring:
token:
# Time in milliseconds before a cached answer token expires.
TTL: 120000

logging:
level:
de:
bluewhale:
sabi: INFO
org:
springframework: ERROR
pattern:
console: '%d{dd-MM-yyyy HH:mm:ss.SSS} %magenta([%thread]) %highlight(%-5level) %logger.%M - %msg%n'
5 changes: 2 additions & 3 deletions captcha/src/main/resources/log4j2-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
<pattern>%d %p %C{1.} [%t] %m%n</pattern>
</PatternLayout>
<Policies>
<!-- rollover daily and when the file reaches
10 MegaBytes -->
<!-- rollover daily and when the file reaches Xxx MB -->
<SizeBasedTriggeringPolicy
size="30MB" />
<TimeBasedTriggeringPolicy />
Expand All @@ -32,7 +31,7 @@
<AppenderRef ref="RollingFile" />
</Root>

<Logger name="de.bluewhale.captcha" level="INFO"/>
<Logger name="de.bluewhale.captcha" level="DEBUG"/>
</Loggers>

</Configuration>
4 changes: 2 additions & 2 deletions devops/sabi_docker_sdk/docker-compose-arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ services:
depends_on:
- db
db:
image: mariadb:11.1
image: mariadb:11.3.2
platform: linux/arm64/v8
environment:
- MYSQL_ROOT_PASSWORD=SuperDooper
Expand Down Expand Up @@ -93,6 +93,6 @@ networks:
sabinet:
driver: bridge

# TODO: application.properties files contains "localhost" this does not matches the hosts,
# Notice: application.properties files contains "localhost" this does not matches the hosts,
# db, fakeSMTP etc.. so the application.properties need to be externalized as in production
# through the assets.
2 changes: 1 addition & 1 deletion devops/sabi_docker_sdk/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ services:
depends_on:
- db
db:
image: mariadb:11.1
image: mariadb:11.3.2
platform: linux/amd64
environment:
- MYSQL_ROOT_PASSWORD=SuperDooper
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
INSERT INTO localized_plague (plague_id, common_name, language, created_on, lastmod_on, optlock)
VALUES (6, 'Stella marina Asterina', 'it', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague (plague_id, common_name, language, created_on, lastmod_on, optlock)
VALUES (5, 'Alghe filamentose', 'it', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague (plague_id, common_name, language, created_on, lastmod_on, optlock)
VALUES (4, 'Dinoflagellate', 'it', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague (plague_id, common_name, language, created_on, lastmod_on, optlock)
VALUES (3, 'Vermi piatti', 'it', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague (plague_id, common_name, language, created_on, lastmod_on, optlock)
VALUES (2, 'Alghe a bolla', 'it', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague (plague_id, common_name, language, created_on, lastmod_on, optlock)
VALUES (1, 'Cianobatteri', 'it', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague (plague_id, common_name, language, created_on, lastmod_on, optlock)
VALUES (6, 'Étoile de mer Asterina', 'fr', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague (plague_id, common_name, language, created_on, lastmod_on, optlock)
VALUES (5, 'Algues filamenteuses', 'fr', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague (plague_id, common_name, language, created_on, lastmod_on, optlock)
VALUES (4, 'Dinoflagellé', 'fr', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague (plague_id, common_name, language, created_on, lastmod_on, optlock)
VALUES (3, 'Vers plats', 'fr', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague (plague_id, common_name, language, created_on, lastmod_on, optlock)
VALUES (2, 'Algues-bulles', 'fr', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague (plague_id, common_name, language, created_on, lastmod_on, optlock)
VALUES (1, 'Cyanobactéries', 'fr', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague (plague_id, common_name, language, created_on, lastmod_on, optlock)
VALUES (6, 'Estrella de mar Asterina', 'es', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague (plague_id, common_name, language, created_on, lastmod_on, optlock)
VALUES (5, 'Algas filamentosas', 'es', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague (plague_id, common_name, language, created_on, lastmod_on, optlock)
VALUES (4, 'Dinoflagelados', 'es', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague (plague_id, common_name, language, created_on, lastmod_on, optlock)
VALUES (3, 'Gusanos planos', 'es', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague (plague_id, common_name, language, created_on, lastmod_on, optlock)
VALUES (2, 'Algas burbuja', 'es', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague (plague_id, common_name, language, created_on, lastmod_on, optlock)
VALUES (1, 'Cianobacterias', 'es', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague_status (plague_status_id, description, language, created_on, lastmod_on, optlock)
VALUES (1, 'Primera aparición', 'es', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague_status (plague_status_id, description, language, created_on, lastmod_on, optlock)
VALUES (2, 'Se extiende', 'es', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague_status (plague_status_id, description, language, created_on, lastmod_on, optlock)
VALUES (3, 'La expansión se estanca', 'es', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague_status (plague_status_id, description, language, created_on, lastmod_on, optlock)
VALUES (4, 'Lento declive', 'es', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague_status (plague_status_id, description, language, created_on, lastmod_on, optlock)
VALUES (5, 'Desaparición (fin de la plaga)', 'es', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague_status (plague_status_id, description, language, created_on, lastmod_on, optlock)
VALUES (1, 'Première apparition', 'fr', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague_status (plague_status_id, description, language, created_on, lastmod_on, optlock)
VALUES (2, 'Se propage', 'fr', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague_status (plague_status_id, description, language, created_on, lastmod_on, optlock)
VALUES (3, 'Extension stagnante', 'fr', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague_status (plague_status_id, description, language, created_on, lastmod_on, optlock)
VALUES (4, 'Recule lentement', 'fr', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague_status (plague_status_id, description, language, created_on, lastmod_on, optlock)
VALUES (5, 'Disparaît (fin du fléau)', 'fr', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague_status (plague_status_id, description, language, created_on, lastmod_on, optlock)
VALUES (1, 'Prima comparsa', 'it', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague_status (plague_status_id, description, language, created_on, lastmod_on, optlock)
VALUES (2, 'Si diffonde', 'it', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague_status (plague_status_id, description, language, created_on, lastmod_on, optlock)
VALUES (3, 'L\'espansione ristagna', 'it', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague_status (plague_status_id, description, language, created_on, lastmod_on, optlock)
VALUES (4, 'Lentamente diminuisce', 'it', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_plague_status (plague_status_id, description, language, created_on, lastmod_on, optlock)
VALUES (5, 'Scomparsa (fine della peste)', 'it', DEFAULT, DEFAULT, DEFAULT);

Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
CREATE TABLE `localized_parameter`
(
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`parameter_id` INT UNSIGNED NOT NULL,
`description` VARCHAR(80) NOT NULL,
`language` VARCHAR(3) NOT NULL,
`created_on` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`lastmod_on` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`optlock` INT UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY `business_key` (`parameter_id`, `language`),
foreign key (parameter_id) references parameter(id)
)
ENGINE = InnoDB
AUTO_INCREMENT = 1
DEFAULT CHARSET = utf8;

ALTER TABLE parameter drop column description;

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (1, 'Karbonathärte', 'de', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (2, 'Temperatur', 'de', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (3, 'Magnesium', 'de', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (4, 'Calcium', 'de', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (5, 'PH', 'de', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (6, 'Phosphat', 'de', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (7, 'Salzgehalt', 'de', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (1, 'Carbonate hardness', 'en', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (2, 'temperature', 'en', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (3, 'magnesium', 'en', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (4, 'calcium', 'en', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (5, 'PH', 'en', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (6, 'phosphate', 'en', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (7, 'Salinity', 'en', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (2, 'temperatura', 'es', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (3, 'magnesio', 'es', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (4, 'calcio', 'es', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (5, 'PH', 'es', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (6, 'fosfato', 'es', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (7, 'Salinidad', 'es', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (1, 'Dureza del carbonato', 'es', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (1, 'Durezza del carbonato', 'it', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (2, 'temperatura', 'it', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (3, 'magnesio', 'it', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (4, 'calcio', 'it', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (5, 'PH', 'it', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (6, 'fosfato', 'it', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (7, 'Salinità', 'it', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (1, 'Dureté carbonatée', 'fr', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (2, 'Température', 'fr', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (3, 'Magnésium', 'fr', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (4, 'Calcium', 'fr', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (5, 'PH', 'fr', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (6, 'Phosphate', 'fr', DEFAULT, DEFAULT, DEFAULT);

INSERT INTO localized_parameter (parameter_id, description, language, created_on, lastmod_on, optlock)
VALUES (7, 'Teneur en sel', 'fr', DEFAULT, DEFAULT, DEFAULT);

Loading

0 comments on commit 60a4e69

Please sign in to comment.