InteractionDesignFoundation / nova-unlayer-field

🦜 Drag’n’drop email builder for Laravel Nova that uses Adds a Laravel Nova field for Unlayer service under the hood.
MIT License
35 stars 9 forks source link

Please make the "Enter fullscreen", "Exit fullscreen" text translatable #3

Closed BenjaminBrandtner closed 4 years ago

BenjaminBrandtner commented 4 years ago

It should be as simple as using the __ translation helper that is available on the Vue instance, i.e. change these lines:

https://github.com/InteractionDesignFoundation/nova-unlayer-field/blob/d965fdfb825d3029cd1dbb4bedd243670db9bb67/resources/js/components/FormField.vue#L29-L34

to this:

on: '▶ ' + __('Enter fullscreen'),
off: '✖︎ ' + __('Exit fullscreen'),

Or maybe it's this.__('Enter fullscreen'), I'm not 100% sure.

Anyway, like this, a developer can define a translation in a translation file and if none is defined it will still display the English text.

A more elaborate alternative (might be overkill) is to make the text completely customizable, something that could be used like this when instantiating the field:

Unlayer::make('something')->withButtonLabels([
    'enterFullscreen' => 'foo',
    'exitFullscreen' => 'bar'
])
alies-dev commented 4 years ago

@BenjaminBrandtner Good idea, thanks for sharing! I just created a simple solution, but have an idea how to improve it in further releases (without BC).

Release: https://github.com/InteractionDesignFoundation/nova-unlayer-field/releases/tag/0.1.2