-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from virtualidentityag/DIAKONIE-274-internatio…
…nalization-for-topics-and-topic-groups feat: make topic titles short and long attributes i18n-aware, make to…
- Loading branch information
Showing
19 changed files
with
300 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/main/java/de/caritas/cob/consultingtypeservice/api/util/TranslationUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package de.caritas.cob.consultingtypeservice.api.util; | ||
|
||
import static de.caritas.cob.consultingtypeservice.api.util.JsonConverter.convertMapFromJson; | ||
|
||
import java.util.Map; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
public class TranslationUtils { | ||
|
||
public static final String DE = "de"; | ||
|
||
private TranslationUtils() { | ||
throw new IllegalStateException("Utility class"); | ||
} | ||
|
||
public static String getTranslatedStringFromMap(final String jsonValue, final String lang) { | ||
final Map<String, String> translations = convertMapFromJson(jsonValue); | ||
if (lang == null || !translations.containsKey(lang)) { | ||
if (translations.containsKey(DE)) { | ||
return translations.get(DE); | ||
} else { | ||
log.warn("Default translation for value not available"); | ||
return ""; | ||
} | ||
} else { | ||
return translations.get(lang); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
..._groups_to_be_i18n_aware/0010_change_topic_and_topic_groups_to_be_i18n_aware-rollback.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
ALTER TABLE consultingtypeservice.`topic` | ||
MODIFY COLUMN titles_short varchar (100); | ||
ALTER TABLE consultingtypeservice.`topic` | ||
MODIFY COLUMN titles_long varchar (100); | ||
ALTER TABLE consultingtypeservice.`topic` | ||
MODIFY COLUMN name varchar (100); | ||
ALTER TABLE consultingtypeservice.`topic` | ||
MODIFY COLUMN description varchar (100); | ||
ALTER TABLE consultingtypeservice.`topic_group` | ||
MODIFY COLUMN name varchar (100); | ||
|
11 changes: 11 additions & 0 deletions
11
...and_topic_groups_to_be_i18n_aware/0010_change_topic_and_topic_groups_to_be_i18n_aware.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
ALTER TABLE consultingtypeservice.`topic` | ||
MODIFY COLUMN titles_short varchar (4092); | ||
ALTER TABLE consultingtypeservice.`topic` | ||
MODIFY COLUMN titles_long varchar (4092); | ||
ALTER TABLE consultingtypeservice.`topic` | ||
MODIFY COLUMN name varchar (4092); | ||
ALTER TABLE consultingtypeservice.`topic` | ||
MODIFY COLUMN description varchar (4092); | ||
ALTER TABLE consultingtypeservice.`topic_group` | ||
MODIFY COLUMN name varchar (4092); | ||
|
9 changes: 9 additions & 0 deletions
9
...and_topic_groups_to_be_i18n_aware/0010_change_topic_and_topic_groups_to_be_i18n_aware.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.1" encoding="UTF-8" standalone="no"?> | ||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> | ||
<changeSet author="dodalovicgran" id="topic_add_titles"> | ||
<sqlFile path="db/changelog/changeset/0010_change_topic_and_topic_groups_to_be_i18n_aware/0010_change_topic_and_topic_groups_to_be_i18n_aware.sql" stripComments="true" /> | ||
<rollback> | ||
<sqlFile path="db/changelog/changeset/0010_change_topic_and_topic_groups_to_be_i18n_aware/0010_change_topic_and_topic_groups_to_be_i18n_aware-rollback.sql" stripComments="true" /> | ||
</rollback> | ||
</changeSet> | ||
</databaseChangeLog> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.