Skip to content

Conversation

@peterbaricic
Copy link
Contributor

Allow user to display custom text (usable for translations)

Allow user to display custom text (usable for translations)
@alessiomaffeis
Copy link
Owner

Thanks for your valuable contribution. Can you just add the props for every other translatable string, consistently named like "stringName"? Here is a quick list:

Line 4:   stringUpload: '<p>Your device does not support file uploading.</p>'  (v-html)
Line 25:  stringDrag: 'Drag an image or <br>click here to select a file' (v-html)
Line 26:  stringTap: 'Tap here to select a photo <br>from your gallery' (v-html)
Line 29:  stringChange: 'Change Photo' (text)
Line 32:  stringSelect: 'Select a Photo' (text)
Line 34:  stringSelected: '<p>Photo successfully selected!</p>' (v-html, add a div)
Line 35:  stringChange: 'Change Photo' (text)
Line 133: stringFileSize: 'The file size exceeds the limit' (text, append ' ( ' + this.size + 'MB)')
Line 148: stringFileType: 'This file type is not supported.' (text)

I hope I haven't missed any. If you can make these changes I will be more than happy to merge the pull request!

@alessiomaffeis
Copy link
Owner

You may want to group them in a single "strings" prop and pass them down as an object:

strings="{ upload: '...', drag: '...', (...) }"

and then in the component prop array:

strings: {
  default: function () {
    return { upload: '...', drag: '...', (...) }
  }
}

This would be more of an "all or nothing" approach, though.

@peterbaricic
Copy link
Contributor Author

I think "all or nothing" is ok, because if someone will want to use his own translation, he will translate everything

@alessiomaffeis
Copy link
Owner

It may be true in case of whole translations, but not if someone wanted to customise just one string. 😉
But I guess it is okay for now, I will fix that later. Thank you very much!

@alessiomaffeis alessiomaffeis merged commit e4f5a9b into alessiomaffeis:master Feb 23, 2017
@alessiomaffeis
Copy link
Owner

Added support for partial strings customisation: b7ab248
It is now possible to do something like:

<picture-input  
  :customStrings="{
      drag: 'Drag a 😺 GIF or <br>click here to select a file',
  }">
</picture-input>

I will update the README accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants