-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Localize error messages #572
Conversation
dcf6eb8
to
f848fff
Compare
@blcham |
3347965
to
54472e4
Compare
54472e4
to
b1ddee9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@palagdan @kostobog What do you think about the following? (
I see a lot of duplicate text, so I am thinking if it is not better to have some .error.genericError as a template (using i18next nesting -- https://www.i18next.com/translation-function/nesting):
{
"error": {
"default": "Došlo k chybě",
"genericError": "Nepodařilo se {{action}} {{object}}. {{error}}",
"faultEvent": {
"findAll": "{{t('error.genericError', { action: 'najít', object: 'události závad' })}}",
"update": "{{t('error.genericError', { action: 'aktualizovat', object: 'událost závady' })}}",
"remove": "{{t('error.genericError', { action: 'odstranit', object: 'událost závady' })}}",
"create": "{{t('error.genericError', { action: 'vytvořit', object: 'událost závady' })}}",
"updateRectangle": "{{t('error.genericError', { action: 'aktualizovat', object: 'obdélník' })}}",
"getFailureMode": "{{t('error.genericError', { action: 'načíst', object: 'režim selhání události' })}}",
"deleteFailureMode": "{{t('error.genericError', { action: 'smazat', object: 'režim selhání události' })}}",
"updateChildrenSequence": "{{t('error.genericError', { action: 'aktualizovat', object: 'pořadí dětí' })}}",
"getRootReusable": "{{t('error.genericError', { action: 'najít', object: 'znovu použitelné události závady' })}}",
"getAllReusable": "{{t('error.genericError', { action: 'najít', object: 'všechny znovu použitelné události závady' })}}"
},
"faultTree": {
"rootEvent": {
"deleteViolation": "Kořenová událost stromu nemůže být smazána!"
},
"intermediateEventAsLeaf": "Mezilehlá událost nemůže být na konci cesty!",
"findAll": "{{t('error.genericError', { action: 'načíst', object: 'stromy závad' })}}",
"findAllWithFilters": "{{t('error.genericError', { action: 'načíst', object: 'stromy závad s filtry' })}}",
"find": "{{t('error.genericError', { action: 'najít', object: 'strom závad' })}}",
"create": "{{t('error.genericError', { action: 'vytvořit', object: 'strom závad' })}}",
"update": "{{t('error.genericError', { action: 'aktualizovat', object: 'strom závad' })}}",
"remove": "{{t('error.genericError', { action: 'odstranit', object: 'strom závad' })}}",
"getTreePaths": "{{t('error.genericError', { action: 'načíst', object: 'cesty stromu' })}}",
"getTreePathsAggregate": "{{t('error.genericError', { action: 'načíst', object: 'všechny cesty stromu' })}}",
"calculateCutSets": "{{t('error.genericError', { action: 'vypočítat', object: 'řezové množiny stromu závad' })}}"
},
or having
- or having just a generic entity error
{
"error": {
"default": "Došlo k chybě",
"entity": {
"findAll": "Nepodařilo se načíst {{entity}}. {{error}}",
"find": "Nepodařilo se najít {{entity}}. {{error}}",
"create": "Nepodařilo se vytvořit {{entity}}. {{error}}",
"update": "Nepodařilo se aktualizovat {{entity}}. {{error}}",
"remove": "Nepodařilo se odstranit {{entity}}. {{error}}"
},
@blcham |
ad 1)
I was not able to find any grammar issue although i do not like it much either. ad 2) we can discuss on the meeting. |
I wanted to discuss one more thing. How should we handle dynamic exception messages like the following with messageId: public class EntityNotFoundException extends FtaFmeaException {
public EntityNotFoundException(String message) {
super(message);
}
public static EntityNotFoundException create(String resourceName, Object identifier) {
return new EntityNotFoundException(resourceName + " identified by " + identifier + " not found.");
}
} |
8d34853
to
765031e
Compare
@palagdan @blcham
For the example above, consider that server sends messageArguments as follows:
Message template can be declared as follows And specific message can be constructed as: |
765031e
to
a2715f0
Compare
ffff763
to
6737c05
Compare
Resolves partially #550