mrmonat / nova-translatable Goto Github PK
View Code? Open in Web Editor NEWNova Field for spatie/laravel-translatable package.
Nova Field for spatie/laravel-translatable package.
Current version requires"spatie/laravel-translatable": "^2.2"
Please update to "spatie/laravel-translatable": "3.*"
Unable to install.
Is there any plan to support the display of translations in the index/list view?
Simplified example:
Resource: Post
(db-table posts
)
Resource: Attribute
(db-table attributes
)
There is a belongsToMany relation between the two (db-table attribute_post
).
This relation has one pivot field called value
.
It's a translatable field.
There is a model (PostAttributes
) for the relation as well:
App\Post.php (attribute relation)
public function attributes()
{
return $this->belongsToMany( Attribute::class )
->withPivot(['value'])
->using( PostAttributes::class );
}
App\Attribute.php (post relation)
public function posts()
{
return $this->belongsToMany( Post::class )
->withPivot('value')
->using( PostAttributes::class );
}
App\PostAttributes.php
use Spatie\Translatable\HasTranslations;
use Illuminate\Database\Eloquent\Relations\Pivot;
class PostAttributes extends Pivot
{
use HasTranslations;
public $translatable = ['value'];
}
Whenever the relation exists in the database it can be edited using Nova.
But when I want to attach a new Attribute
to the Post
I get the following error:
Could not find a matching version of package mrmonat/nova-translatable. Check the package spelling, your version constraint and that the package is available in a
stability which matches your minimum-stability (stable).
it seems the error related to the repo name change?
Global search and resource search are powerful tools in Nova, but sadly they did not work with translatable package if the title or name field is translatable.
I think this is a killer issue that need to be addressed. It may be out of scope of this package itself, but how can we address this issue?
It's nice to have the index text displayed by default using the app()->getLocale()
What about having a language switcher card? so the admins can easily switch the language?
I don't now if Nova table offer better customization options to include the language switcher before or after each table, but at least the switcher card can help overcome the problem right now?
Hi, I have a problem with creating translatable field. I have spatie/laravel-translatable so my model looks like this however i am not able to show any of these fields as translatable...what can be wrong
`use Spatie\Translatable\HasTranslations;
class Manufacturer extends Model
{
use HasTranslations;
protected $translatable = ['name','description','description_short','meta_title','meta_keywords','meta_description'];
`
I'm using nova-translatable for a Trix field. This works well because of the Trix support that this package has. With Nova, the Trix field has a "withFiles" method which makes it possible to upload files into the editor, see: https://nova.laravel.com/docs/1.0/resources/fields.html#field-types
Is it possible to add this possibility -> being able to activate the file-upload ability of the Trix editor.
Hi,
Any chance we can have the text direction to be RTL if any RTL languages selected Ex. "Arabic or Hebrew", as typing in RTL language with LTR direction looks very weird.
Hi,
thanks for creating this package and using ours as an underlying dependency.
The current name of your package could make people think that we created it. Could you rename it so it doesn't have spatie
in it anymore?
I'd also accept a PR to spatie/laravel-translatable
that adds a link in the readme to your nova package.
Thanks!
Unable to attach the image with the Trix editor. Cannot call Laravel Nova Trix editor's ->withFiles
method.
hi, could you tell me how to change the size of the field?
I found:
<div class= "px-8 py-6": class= "computedWidth">
but even after compilation nothing changes.
Hi. First thanks for this amazing package. I like it a lot.
I need a little help with how can I use translations on the website. Like I want to switch languages and keep in the cookie.
Spatie documentation is only for Nova and cannot be figured out how to use translations. I really need help.
Thanks.
When using the combination "Shift + ?" It focuses on global search when using Translatable Trix editor.
Similar issue laravel/nova-issues#513
I make default value for text or trix field, but this not work, default value empty.
Tell me please, maybe there is a hack how to fix it?
spatie/laravel-translatable has moved to 6.0.
Are we expecting its support sooner?
Why not to have global locales array within config file? with the ability to override the array for each fields like the current syntax?
Please change the element classes, and type, on the help-text/error-text.
It is much easier to set custom styles if the classes and type, are the same as in Nova.
In your component the error and help text is:
<p class="my-2 text-danger"></p>
In Nova field components the error-text is a <div>
.
<div class= "help-text error-text mt-2 text-danger"></div>
How to apply validation with rules()
Is it possible to have the current app locale dictate which translation tab is selected by default when the edit/show page is loaded? I mean when I have my app locale set to say 'bg' I want to see the Bulgarian translation of the field selected by default then click to check out the rest of the translations. Can you help with this? Thanks. Cheers!
I use trix and markdown field types for translatable content, adding support to this field types will be really useful.
Laravel-translatable has moved to a 5.* series, but this package locks 4.*.
Could you please tag a release that supports 5.*? Thanks!
The Field does not work with the new "withFiles()" method when using Trix:
Translatable::make('Content')->trix()
->withFiles('public')
->hideFromIndex()
->sortable()
->rules('required'),
It throws Call to undefined method MrMonat\\Translatable\\Translatable::withFiles()
Hey, really amazing project.
I have a request though, it would be nice to provide ability to create translatable images.
Lets say we have an image field in the database with the json column type.
If we are creating a blog post with multiple locales, we also need to have an ability to attach image for those locales. This is quite useful if main post image contains text in different locales.
Hi There!
Appreciate the work you've done, thanks to your package our project became feasible with Nova ๐
But, there's a slight problem... the Nova Field base class allows for appending a help text to the fields, this is not currently supported by the package ๐ข
I think that a general (not locale dependent) help text would be enough for a start.
Hi
The default field in nova has an asterisk if it is required but unfortunately, this field doesn't have that. I would create a pull request in the next couple of hours, would you consider merging it?
Best regards,
Andy
PS: Here's the PR
Hi all,
I think changing the activated tab to the indexLocale
(defined meta) or, instead of this (only when this translation isn't available), change to the defined translatable.fallback_locale
config
When using Translatable::make('field name')->trix(), the complete html content is displayed on details page, including all of the html tags;
Say we have a field like:
Translatable::make( __('Slug'), 'slug')->rules('required')->sortable()->help(__('help.tips.slug')),
In our application, we have two locales.
If I try to submit the form without entering a value for either locale, I get a validation error stating that the field is required.
However, if I enter a value for only one of the two locales, the submission goes through.
How can we require that all a value is present for all locales?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.