diff --git a/src/components/editorElements/tagInput/view/tagInputView.js b/src/components/editorElements/tagInput/view/tagInputView.js index ae4fce11a..fe8051a18 100644 --- a/src/components/editorElements/tagInput/view/tagInputView.js +++ b/src/components/editorElements/tagInput/view/tagInputView.js @@ -41,30 +41,42 @@ const TagInput = ({ cats.length > 10 ? Alert.alert( intl.formatMessage({ id: 'alert.error' }), - 'Only 10 tags allowed, remove some', + intl.formatMessage({ id: 'editor.limited_tags' }), ) : cats.find(c => c.length > 24) ? Alert.alert( intl.formatMessage({ id: 'alert.error' }), - 'Tag maximum length should be 24', + intl.formatMessage({ id: 'editor.limited_length' }), ) : cats.find(c => c.split('-').length > 2) - ? Alert.alert(intl.formatMessage({ id: 'alert.error' }), 'Use one dash in Tags') + ? Alert.alert( + intl.formatMessage({ id: 'alert.error' }), + intl.formatMessage({ id: 'editor.limited_dash' }), + ) : cats.find(c => c.indexOf(',') >= 0) - ? Alert.alert(intl.formatMessage({ id: 'alert.error' }), 'Use space to separate Tags') + ? Alert.alert( + intl.formatMessage({ id: 'alert.error' }), + intl.formatMessage({ id: 'editor.limited_space' }), + ) : cats.find(c => /[A-Z]/.test(c)) - ? Alert.alert(intl.formatMessage({ id: 'alert.error' }), 'Only use lower letters in Tags') + ? Alert.alert( + intl.formatMessage({ id: 'alert.error' }), + intl.formatMessage({ id: 'editor.limited_lowercase' }), + ) : cats.find(c => !/^[a-z0-9-#]+$/.test(c)) ? Alert.alert( intl.formatMessage({ id: 'alert.error' }), - 'Use only allowed characters in Tags', + intl.formatMessage({ id: 'editor.limited_characters' }), ) : cats.find(c => !/^[a-z-#]/.test(c)) - ? Alert.alert(intl.formatMessage({ id: 'alert.error' }), 'Tag must start with letter') + ? Alert.alert( + intl.formatMessage({ id: 'alert.error' }), + intl.formatMessage({ id: 'editor.limited_firstchar' }), + ) : cats.find(c => !/[a-z0-9]$/.test(c)) ? Alert.alert( intl.formatMessage({ id: 'alert.error' }), - 'Tag must end with letter or number', + intl.formatMessage({ id: 'editor.limited_lastchar' }), ) : null; handleTagChanged([...cats]); diff --git a/src/config/locales/en-US.json b/src/config/locales/en-US.json index c8d8ce328..ade954cb1 100644 --- a/src/config/locales/en-US.json +++ b/src/config/locales/en-US.json @@ -252,7 +252,15 @@ "publish": "Publish", "reply": "Reply", "open_gallery": "Open Gallery", - "capture_photo": "Capture a photo" + "capture_photo": "Capture a photo", + "limited_tags": "Only 10 tags allowed, remove some", + "limited_length": "Maximum length of each tag should be 24", + "limited_dash": "Use one dash in each tag", + "limited_space": "Use space to separate tags", + "limited_lowercase": "Only use lower letters in tag", + "limited_characters": "Use only allowed characters in tag", + "limited_firstchar": "Tag must start with a letter", + "limited_lastchar": "Tag must end with letter or number" }, "pincode": { "enter_text": "Enter PIN to unlock",