Astrotomic laravel translatable github

Astrotomic laravel translatable github


Astrotomic laravel translatable github. The package will take the name field and try to save it to the TitleTranslation model using the default locale, contrary to the expected behavior that it should save it to the Title model. I used to use spatie/laravel-translatable to handle translations of my models and now i moved to Astrotomic/laravel-translatable Everything works fine except that Astrotomic/laravel-translatable doesn't detect accept-language automatically. Has anyone tried using translatable with spatie/laravel-query-builder ? If so, how can I sort by translation fields? Thanks You signed in with another tab or window. It’s now common knowledge that one of the best tools to tackle the climate crisis and keep our temperatures from rising above 1. Notifications You must be signed in to change 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. Astrotomic / laravel-translatable Public. Also for deleting the translations. Saved searches Use saved searches to filter your results more quickly You signed in with another tab or window. With the withTrashed scope I can update my (soft)deleted records. 17, filame Astrotomic / laravel-translatable by Gummibeer. Right now some GitHub actions are failing - they should be fixed to work again. Follow these steps to get started: Press the "Use template" button at the top of this repo to create a new repo with the contents of this skeleton. Just stumbled upon the same issue. A strategy instance should be created via DIC - this way an instance could also be bound, possible required injections will be done and custom arguments could be passed via an array like for LocaleStrategy. So let's assume we have posts and post_translations table. since laravel-translation and laravel-translatable have a different usecases . The content column can contain more than 10,000 characters. Inspired by spatie/laravel-translatable, another alternative for the translation package for your Laravel application. Notifications You must be signed in to change notification settings; Fork 156; Star 1. I have a question about timestamps. 5), the translated attributes are not saved in the database when using mass update. I'm using the translation in nearly all of my tables, and at the same time, I'm eager loading the translations for each model as follows class Provider extends Model implements TranslatableContract, HasMedia { use Translatable; public fu It would be nice to be able to access the translations in the condition of the updateOrCreate method just like when using it when doing insert. 2; The text was updated successfully, {"payload":{"allShortcutsEnabled":false,"fileTree":{"src/Translatable":{"items":[{"name":"Contracts","path":"src/Translatable/Contracts","contentType":"directory How to get translations for many rows retrieved by eloquent queries with one or few database queries? If there is no translation for some of these rows the default fallback to be used. Right now this logic is provided by Database engine on delete cascade feature or equivalent, so it will not work by default with Laravel's soft deletes. article_translations contains two translatable columns title and content. Moin :-) I just tested it and it works as expected. PHP8. I think what you mean is that there's a translations "attribute" if you do toArray() or toJson() which contains all translations. Sign up for GitHub By public $ translationModel = \ Astrotomic \ Translatable \ Test \ Model Laravel 9; aAtrotomic/Laravel-translatable: 11. Code; Issues 21; Pull 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. ) Astrotomic/laravel-translatable Dears, is there is any one do full implementation for this package , as per i have issue i need to make two inputs for name for example , and i need two inputs one for en and one for ar , and i nee In my implementation we add content in single(en) language and users translate the content. so using laravel-translatable for translating models and editing/import/export the translations using laravel-translation Astrotomic/laravel-translatable Dears, is there is any one do full implementation for this package , as per i have issue i need to make two inputs for name for example , and i need two inputs one for en and one for ar , and i nee Astrotomic/laravel-translatable I&#39;ve created a model with translatable name and a simple Filament resource but when I click on edit or delete buttons on the list page I get an error: App\Models\Test::getAttributeAndLocale(): You signed in with another tab or window. While trying to get translation laravel looks for shop_category_id, but in translations table I set j Right now some GitHub actions are failing - they should be fixed to work again. 2k. If you contribute to my forest you’ll be creating employment for local families This is the update method in my controller. Notifications Fork 142; Star 1. It was able to return the desired translation with default translation. however unifying usage would really be good. I have a multilingual website with a blog page that shows all my posts. If you’ve found a astrotomic/laravel-translatable: Handles translations for Eloquent models. You switched accounts on another tab or window. 5C is to plant trees. Describe the bug When using the correct version of the package for Laravel 5. To Reproduce Config Translatable: Create ModelTranslation Configure Model with Translatable ; populate translation table: Screenshots Testing using tinker Versions (please complete the fo A Laravel package for multilingual models. Purpose: When working with DTOs, we've found it useful to be able to wrap all the translations into a specific property when creating multiple records at once. Here I want to reduce sql queries , Please guide me if my way is true or wrong, Please see my queries Here I have two sql for per request, for example : I want to make You signed in with another tab or window. 50. By default the locale returned by Locales::current() is used to get/set the attribute from the translation model. I have this in my config file: return [ 'locales' => [ 'en', 'es', ], 'locale_separator' => '-', 'locale' => null, 'use_fallback' => true, 'use_property_fallback Making Eloquent models translatable. I have the following: Cache::tags(['food', 'food-products'])->rememberForever('non-empty This repo can be used to scaffold a Laravel package. Packagist Link. mcamara/laravel-localization, Astrotomic/laravel-translatable, auth, spatie/searchable - GitHub - adved85/multi-trans-lang-auth7: mcamara/laravel-localization What would be the correct way to save initial model data with translations (rather than first creating the data in a local then creating form to update translations, i am already doing that) ? Hey, I've added a branch to test with the current dev version. Please make sure you have run php artisan vendor:publish --provider="Astrotomic\Translatable\TranslatableServiceProvider" and that the locales Astrotomic / laravel-translatable Public. Sign up for GitHub By clicking “Sign up You signed in with another tab or window. I have the following: Cache::tags(['food', 'food-products'])->rememberForever('non-empty You're free to use this package, but if it makes it to your production environment I would highly appreciate you buying the world a tree. Describe the bug when I place a column name in translatedAttributes array no longer can store into that column. To Reproduce Bellow my You signed in with another tab or window. diglactic/laravel A Laravel package for multilingual models. Code; Issues 20; Pull 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. The package overrides the setAttribute() and getAttribute() methods to allow direct access to translated attributes from the main model. Discuss code, ask questions & collaborate with the developer community. Pick a username Email Address Password You signed in with another tab or window. 😉 If you just want to keep track of the author of the original page the relation should be between page and user - I Navigation Menu Toggle navigation. As such, my main locale as well as my fallback_locale both are 'fr' in Laravel's config. 11 would generate: Obviously, v11. Github Link. Fallback to actual model value dimsav/laravel-translatable#397; Usability for a translatable field of a model? dimsav/laravel-translatable#471; Conditionally enabling translations for models / multi tenancy dimsav/laravel-translatable#537 Astrotomic / laravel-translatable Public. This will allow the package to use the translator/app locale instead of the hardcoded one. Description: Adding the ability to wrap multiple translations when creating new records. Pre You signed in with another tab or window. Improve the code quality by installing phpstan/larastan and increase the level to at least 6. I hope there is a way to set up lazy loading also on relations entities. 10 and v11. After running php artisan migrate:fresh --seed or php artisan db:seed page is created but no translations are saved to the database. I actually never had to use that when() function and realized that this is a quite nice solution. I'm supposed to write mostly in French, but some articles in English. php with default 'en' You signed in with another tab or window. My application is used by different users using different locale. Code; Issues 19; Pull requests 1; Discussions; Actions; Security; Insights New A Laravel package for multilingual models. Thanks! Astrotomic / laravel-translatable Public. You signed in with another tab or window. Laravel 9; aAtrotomic/Laravel-translatable: 11. After this you can generate the po files and the proper header with artisan trans:po. Code; Issues 19; Pull requests 1; Discussions; Actions; Security; Insights New issue since laravel-translation and laravel-translatable have a different usecases . But it should be irelevant. Sign up for GitHub By use \ Astrotomic \ Translatable \ You signed in with another tab or window. Could this have something to do with Laravel? My environment is Hello, First of all, thank you for this great package. It does the sql query for every row. Astrotomic/laravel-translatable I&#39;ve created a model with translatable name and a simple Filament resource but when I click on edit or delete buttons on the list page I get an error: App\Models\Test::getAttributeAndLocale(): You signed in with another tab or window. I have a regions table with a regions_translations - works fine I have a properties table with a properties_translations - works fine Where I am stuck at, and cannot find an example anywhere, is how to deal with the region_id in my prope Conditionally enabling translations for models / multi tenancy dimsav/laravel-translatable#537 And this wasn't supported at any time and also won't be official be supported in the future. Hey guys, i have the problem that my orderByTranslation is getting ignored. Something like that: Model::updateOrCreate([ 'model_i You signed in with another tab or window. Like A Laravel package for multilingual models. With this package you write less Astrotomic is an open source developer collective and wants to provide helpful, solid and easy to use open source packages. This is a Laravel package for translatable models. Code; Issues 14; Pull requests 2; 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. 19 app I use astrotomic/laravel-translatable 11. A relation between page_translation and user is only useful if you want to track the author of the specific translation. Code; Issues 19; Pull requests 1; Discussions; Actions; Security; Insights New issue Hi i want to ask you if for example locale app = Spanish and don't found Spanish translate or null field can i set default translate from English . Describe the solu Astrotomic / laravel-translatable Public. Sign up for GitHub By clicking “Sign up Is your feature request related to a problem? Please describe. In config/translatable. Example You signed in with another tab or window. How can i use route binding? I Have a BlogController to get post or article, but i want to use Route Binding to get blog by "slug" You signed in with another tab or window. . Notifications You must be signed in to change notification settings; Fork 153; use Astrotomic\Translatable\Contracts\Translatable as TranslatableContract; use Astrotomic\Translatable\Translatable; use Describe the bug When using the correct version of the package for Laravel 5. Describe the bug After the upgrade to 11. I identified a need that the translatable fields in a form should be nullable, but not save an empty string in the translations related table of the model, because if the locale is available it would return an empty string instead of the configured default from the model. I need to write a withTranslations() for each query. Expected behavior You signed in with another tab or window. With this package you write less code, as the translations are being Contribute to AlaaMekheimar/astrotomic-laravel-translatable development by creating an account on GitHub. However, if a blog post isn't translated (yet) to the current locale of the visitor, it just shows an empty post card without any content. But the translations don't get updated. Then the following figure is the query statement that V11. Sign in Product Here's our situation, our fallback_locale is DE. To Reproduce It appears that the later part ( slide_translations. If you need help to implement Translatable with these extensions, see this example. Describe the bug When running php artisan queue:work The job fails and the exception is: TypeError: Return value of Astrotomic\Translatable\Locales::current() must be of the type string, null returned in D:\Boryas\plan\vendor\astrotomic\ In my opinion, since a translation record is useless without a Translatable model related to it, it should be deleted by default by the package using some kind of technique like an event listener on the delete event. I wonder if there is an option that I'm missing to ignore the second condition, or the package needs a small improvement. We have one model called Post which dynamically changes the default locale based on a column in the database (primary_language), depending on the language the user wrote the post in. Notifications You must be signed in to change notification settings; Fork 155; Star 1. They should be added to the GitHub action test matrix. This should include a GitHub action and probably adding a new badge to readme & docs. Code; Issues 22; Pull 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. Notifications Fork 130; Star 1k. LOWER(name) which obviously doesn't work. Yes, I have read it some times and try to learn more about laravel validation but it's not lucky for me. This is because of the way the package use __get() and __set() methods to make read and write operations on translated attributes work in a shorter syntax, that is instead of writing: Of course this would mean that if the German tag would be deleted (and the same would be true for the post accordingly), this pivot table needs to be cleaned up as well. Code; Issues 14; Pull requests 1; Discussions; Actions; Security; Insights; 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. We copy the configuration file to our project. To Reproduce Article Model: use Astrotomic\Translatable\Translatable; use Astrotomic\Translatable\Contracts\Translatable as T Astrotomic / laravel-translatable Public. It A Laravel package for multilingual models. Notifications Fork 137; Star 1. See more configuration examples of the Filament panel in GalaxyStore - demo project with Filament, Astrotomic package and more. 17/18 · astrotomic/laravel-translatable. 12 (since we need Laravel 10 support) our translations are broken. Describe the bug I created a seeder with example translations for Page model. Notifications Fork 144; Star 1. Navigation Menu Toggle navigation. The array $translatedAttributes Translatable is fully compatible with all kinds of Eloquent extensions, including Ardent. I have a problem, we need eager load ONLY. 12 for multi language (I mean different text data in database, not just labels on site pages) site where I also usefilament 2. This pull request introduces two custom validation rules, translatableExists, and translatableUnique, tailored specifically Is it possible to set custom foreign key in translatable model? For example I have a model ShopCategory (with table "shop_categories"). Its goal is to remove the complexity in retrieving and storing multilingual model instances. This is the correct behavior. Because in foreach loop l have query to database it`s a bad. I think that the problem relates to the fill(), setAttribute() and/or getAttribute() methods which have problems with the translated attribute from the join. To Reproduce Article Model: use Astrotomic\Translatable\Translatable; use Astrotomic\Translatable\Contracts\Translatable as T You signed in with another tab or window. Describe the bug Doesn´t save model translations. The project I am currently working on is available in de and de-AT. See more configuration examples of the Filament panel in Do you have general questions or suggestions for improving the package? Feel free to create an issue on GitHub, we’ll try to address it as soon as possible. 1k. Then every model have its own xmodel_translations table where model translations are stored. 11 is a lot more complicated. To Reproduce Install Nova v3 Setup a model and resource that is translatable Create a new resource, and then try and update its fields O The text was updated successfully, but these errors were encountered: You signed in with another tab or window. mapping models translatable attributes to a single translations table Describe the solution you'd like using a single translations table for every models translatable attribu This is a Laravel package for translatable models. You signed out in another tab or window. I need to run php artisan db:seed --class=PageSeeder (this class is called in DatabaseSeeder) to have not only page, but Describe the bug //Set the locale App::setLocale('mi'); //Loa Modal with translation Modal::withTranslation()->get(); It only returns the default translation en. Example: SomeModel::all(); The problem is that I can Laravel 9; aAtrotomic/Laravel-translatable: 11. 2 & 8. According to the docs, there is no created_at and updated_at columns on translation tab I have Area Model translate to (ar, en) everything is good but BUT when I open the debugger I found there is 21 queries run!! my foreach: my code in controller: Models: Post, PostTranslatable Let's say i have 3 localizations: 'en', 'ru', 'fr' 'en' title is 'Some title' 'ru' title is 'Заголовок' 'fr' title is '(empty)'and if i go to localhost/fr/posts i see empty title but tied styles are still there(: How can i check if posts->title (fr) or other languages are null and hide images, styles from PostModel In laravel 9. The user fills the table, and the translations will be updated accordingly (if they leave it empty, then no translation for that language. 10 will generate: Here is the statement that V11. Saved searches Use saved searches to filter your results more quickly Describe the bug I am using this with Nova, but none of the translatable fields seem to be updating. How do I migrate my existing table to use This is a Laravel package for translatable models. Configuration. Hey, set the locale value in your translatable config to null. Dear Gummibeer, Thank you for replied. All reactions. The user fills the table, and the translations will be updated accordingly (if they leave it empty, then no translation fo Hi, the documentation says I should implement the contract in the model to be translated, like this : use Astronomic\Translatable\Contracts\Translatable as TranslatableContract; use Astrotomic\Translatable\Translatable; use Illuminate\Da Laravel 11 will be released within a few weeks - so it should be added to composer. If you want to use different locales for the app/translator and this translatable package you have to change this config value to the value you want - possibly, like the app locale, on runtime. When I need to select non translatable fields for example only id and call Model::all(['id']) it still tries to load translations and runs N+1 query. Hi, I'm trying to get this package working in Lumen. calebporzio/parental: A parent-child relationship for Eloquent models. slide_id is not null` ) is un-neccessary. In this case I would rename it to author_id. The package provides and interface \Astrotomic\Translatable\Contracts\Translatable which describes the public API. json & GitHub action test matrix & readme/docs. Depends on your table structure, the reason for the relation and so on. Trying to use any other version fails when issuing composer update To So either for everbody in the next release or somewhere in our Laravel installation outside the vendor-directory? I tried to use the LOWER(xxx) instead, but this resulted in. product_translations. Notifications You must be signed in to change notification 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. Reload to refresh your session. Code; Issues 15; Pull requests 0; Discussions; Actions; Security; Insights; 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. composer require astrotomic/laravel-translatable. Contribute to Astrotomic/laravel-translatable development by creating an account on GitHub. To generate the po files you first have to compile all your views, PoEdit can't handle blade, to do this use the artisan command artisan view:compile. Anyway, any package should not affect to another workflow of the application. info (Tom Witkowski) Package Create Date: 2019-06-17 : . But you can also pass a locale after the attribute name like title:en this will get/set the title attribute Is your feature request related to a problem? Please describe. 1; We use this package with Spatie/Querybuilder package. And while I will translate many posts (and pages) into German and also German-Austrian there will be always some posts only available in Description: Incorporating unique and existence validation for translatable attributes can be crucial for many projects. You shouldn't do toArray() to get an API response. Split \Astrotomic\Translatable\Translatable into multiple traits - but use them in the main one Inspired by spatie/laravel-translatable, another alternative for the translation package for your Laravel application. Code; Issues 15; Pull probably due to the abstraction that laravel-translatable does. Hey, with one rule factory it isn't. The idea is that in my view I have a table, one row for each language. Is there a way in which i can change the fallback locale of translation as per the model instead of a global configuration. i am new in laravel and use Astrotomic / laravel-translatable package for translation i have problem when i want to add two langue at same time. It looks like there is no way to configure the fallback per property but you can return your attribute using the translate() method to prevent returning the fallback translation: $ this-> translate ()-> url; // Returns the URL only in the current locale even if fallback_locale is set to true The text was updated successfully, but these errors were encountered: On laravel 9 site I added astrotomic/laravel-translatable and getting set of data I see a bit different results I expected As I have 2 languages defined in config/translatable. This is a Laravel package for translatable models. Is your feature request related to a problem? Please describe. To Reproduce Hi friends!, I want to use join when script getting the translations. Instead you should use an eloquent API resource class and map your Astrotomic / laravel-translatable Public. I tested v11. Changes: Added translations_wrapper config to allow user to set a custom wrapper name. The current Laravel validation doesn't inherently support this functionality, prompting the need for custom solutions. My question is, How can I use the translation for pluck or selected row? Hello, Following the example in the documentation Page::listsTranslations('title')->get(); I get an empty array as result, even if I have double-checked the settings in Page and PageTranslation. About I'm wondering if there's any method, when using getTranslationOrNew, to fill the parent id? So for example when using getTranslationOrNew on a dog() table it would have dog_id pre-filled for the newly created translation. Hi, I'm using the Laravel SoftDeletes for deleting my models. Love the package, btw! Switch to Astrotomic was easy as pie. This package is an extension for Filament and laravel-translatable. so using laravel-translatable for translating models and editing/import/export the translations using laravel-translation Hey there! I need to use Pluck or select from the database for simple tasks in big tables. - rslanzi/nova-translatable You signed in with another tab or window. translate (?string $locale = null, bool $withFallback = false) Alias of: getTranslation(?string $locale = null, bool $withFallback = null) This Explore the GitHub Discussions forum for Astrotomic laravel-translatable. a solution to this? — You are receiving this because you were mentioned. Like expected everything looks fine and the package is ready to go with it. That is right as long as the workflow doesn't touch the package. Or you hardcode your additional locale and rule and use array_merge_recursive() to add the additional rule to the primary locale. if I use all() then it could be an issue. But you could use multiple with a different set of locales and rules and merge the resulting Arrays. The signature of called method should retrieve a lot of arguments to also handle model aware logic, attribute specific fallback and so on. Copy php artisan vendor: The translatable model Post should use the trait Astrotomic\Translatable\Translatable. Instead a new record is created. To get all the articles I do this: This is a Laravel package for translatable models. Pick a username Email Address Laravel: 9. With this package you write less This is a Laravel package for translatable models. This package relies on a separate DB table to contain all of your localized model This is a Laravel package for translatable models. The default convention for the translation model is PostTranslation. A Laravel package for multilingual models. Pick a username Email Address Password Sign up Conditionally enabling translations for models / multi tenancy dimsav/laravel-translatable#537 And this wasn't supported at any time and also won't be official be supported in the future. Multi-Language Laravel 11: All You Need to Know. With this package you write less code, as the translations are being The translatable model Post should use the trait Astrotomic\Translatable\Translatable. But if I use laravel's default's with() You signed in with another tab or window. 3 are supported but not part of the test matrix right now. database translation language laravel. Notifications You must be signed in to change notification settings; Fork 150; 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. Will do my best to release it as fast as possible after official L6 release. The main table using translations has an UUID key used for the getTranslationRelationKey(), so imagine having a table called "properties" with an "uuid" primary key and the translations are stored in property_translations. Trying to use any other version fails when issuing composer update To Hey guys, i have the problem that my orderByTranslation is getting ignored. Some of them can be deleted by softDelete. Now with slugs, there is a possibility for some slugs to never get translated. To collect Describe the bug I removed dimsav/laravel-translatable using the steps you mention here replaced Dimsav\ by Astrotomic\ in my whole project but when I change the locale to en every static translations on page comes en but the dynamic tra A Laravel package for multilingual models. 11 in the same project to make sure the version of the Laravel framework is the same. Sign up for GitHub By clicking “Sign up Hi there, I have a transation_locales table where are all awailable languages for application. Hey, also the other models will use the same locale as all your models. Package Data; Maintainer Username: Gummibeer: Maintainer Contact: gummibeer@astrotomic. i have Get an instance of the translation model. I've added this to composer ran the necessary migrations and now hit a roadblock. Sign up for GitHub By And does your category model use the Translatable trait? This is a Laravel package for translatable models. If 10 rows, it's 1 sql for my product table, 10 sql for product_relations table. Good afternoon! I have a table of articles and article_translations. Reply to this email directly, view it on GitHub <#162 (comment)>, or (dimsav/translatable), however it's read only. With this package you write less A Laravel package for multilingual models. At the end you will have to add/merge your rules manually. 12. Notifications You must be signed in to change notification settings; Fork 154; Star 1. Most of them will be for Laravel - but sometimes Interface. Contribute to spatie/laravel-translatable development by creating an account on GitHub. Sign in Product Corneel-D/astrotomic-laravel-translatable-plugin This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. Pick a username Email Address kcassam wants to merge 1 commit into Astrotomic: main from We would like to show you a description here but the site won’t allow us. This Laravel Nova field allows you to manage translated fields with astrotomic/laravel-translatable, also with a CKEditor WYSIWYG. This is the update method in my controller. With this package you write less code, as the translations are being fetched/saved when you fetch/save your instance. Every value of a column relates to a locale so it could put into the translation table. Hi thank you for the wonderful package. A Laravel package for multilingual models 20 . 6 (v11. php, I set locale to null, use_fallback to true, use_property_fallback to true, and fallback_locale to null. Describe the bug Trying to fetch data by locale id (Indonesian), the translation result of name property returns null, meanwhile it works when fetching the data by locale en (English). {"payload":{"allShortcutsEnabled":false,"fileTree":{"src/Translatable":{"items":[{"name":"Contracts","path":"src/Translatable/Contracts","contentType":"directory upgrade test code base to current standard #73 optimize test classes performance and readability LocalesTest #77 ScopesTest #86 TestCoreModelExtension #87 TranslatableTest #84 ValidationTest #88 Remove temp TestsBase class #81 A Laravel package for multilingual models. Hi, First I want to thank you for the nice library. bombudf jgpx nohl lux alplvrtt dkyvbde dalx khhv rrcul ozovv