Astrotomic laravel translatable github


  1. Home
    1. Astrotomic laravel translatable github. 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. Notifications Fork 130; Star 1k. Sign up for GitHub By public $ translationModel = \ Astrotomic \ Translatable \ Test \ Model Laravel 9; aAtrotomic/Laravel-translatable: 11. Will do my best to release it as fast as possible after official L6 release. Is your feature request related to a problem? Please describe. But the translations don't get updated. Now with slugs, there is a possibility for some slugs to never get translated. It A Laravel package for multilingual models. 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. Code; Issues 19; Pull requests 1; Discussions; Actions; Security; Insights New issue since laravel-translation and laravel-translatable have a different usecases . Love the package, btw! Switch to Astrotomic was easy as pie. 11 would generate: Obviously, v11. ) 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. Notifications You must be signed in to change notification settings; Fork 156; Star 1. It was able to return the desired translation with default translation. Or you hardcode your additional locale and rule and use array_merge_recursive() to add the additional rule to the primary locale. Every value of a column relates to a locale so it could put into the translation table. 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. To Reproduce Bellow my You signed in with another tab or window. Like A Laravel package for multilingual models. 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"). - rslanzi/nova-translatable You signed in with another tab or window. 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. It does the sql query for every row. As such, my main locale as well as my fallback_locale both are 'fr' in Laravel's config. The package provides and interface \Astrotomic\Translatable\Contracts\Translatable which describes the public API. 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. With this package you write less A Laravel package for multilingual models. 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. 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. 5C is to plant trees. 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. 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. This should include a GitHub action and probably adding a new badge to readme & docs. Notifications You must be signed in to change notification settings; Fork 154; Star 1. This is a Laravel package for translatable models. To Reproduce Article Model: use Astrotomic\Translatable\Translatable; use Astrotomic\Translatable\Contracts\Translatable as T Astrotomic / laravel-translatable Public. 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. Hey, also the other models will use the same locale as all your models. Sign up for GitHub By clicking “Sign up Is your feature request related to a problem? Please describe. 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. Packagist Link. We copy the configuration file to our project. 6 (v11. php, I set locale to null, use_fallback to true, use_property_fallback to true, and fallback_locale to null. I think what you mean is that there's a translations "attribute" if you do toArray() or toJson() which contains all translations. Github Link. 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. since laravel-translation and laravel-translatable have a different usecases . Notifications Fork 137; Star 1. You signed in with another tab or window. Describe the bug After the upgrade to 11. Also for deleting the translations. A Laravel package for multilingual models. But it should be irelevant. I hope there is a way to set up lazy loading also on relations entities. I have a multilingual website with a blog page that shows all my posts. 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. Could this have something to do with Laravel? My environment is Hello, First of all, thank you for this great package. 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. info (Tom Witkowski) Package Create Date: 2019-06-17 : . In config/translatable. A relation between page_translation and user is only useful if you want to track the author of the specific translation. 1k. I think that the problem relates to the fill(), setAttribute() and/or getAttribute() methods which have problems with the translated attribute from the join. Hey, set the locale value in your translatable config to null. Like expected everything looks fine and the package is ready to go with it. 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. If you need help to implement Translatable with these extensions, see this example. Moin :-) I just tested it and it works as expected. The signature of called method should retrieve a lot of arguments to also handle model aware logic, attribute specific fallback and so on. Good afternoon! I have a table of articles and article_translations. To get all the articles I do this: This is a Laravel package for translatable models. Just stumbled upon the same issue. By default the locale returned by Locales::current() is used to get/set the attribute from the translation model. Instead you should use an eloquent API resource class and map your Astrotomic / laravel-translatable Public. 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. To Reproduce Article Model: use Astrotomic\Translatable\Translatable; use Astrotomic\Translatable\Contracts\Translatable as T You signed in with another tab or window. 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. 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. You shouldn't do toArray() to get an API response. Trying to use any other version fails when issuing composer update To Hey guys, i have the problem that my orderByTranslation is getting ignored. This package is an extension for Filament and laravel-translatable. php with default 'en' You signed in with another tab or window. a solution to this? — You are receiving this because you were mentioned. Something like that: Model::updateOrCreate([ 'model_i 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. Pick a username Email Address Laravel: 9. Dear Gummibeer, Thank you for replied. Improve the code quality by installing phpstan/larastan and increase the level to at least 6. Hi, I'm using the Laravel SoftDeletes for deleting my models. I've added this to composer ran the necessary migrations and now hit a roadblock. database translation language laravel. Configuration. 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. 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. Sign up for GitHub By clicking “Sign up You signed in with another tab or window. 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. To Reproduce It appears that the later part ( slide_translations. 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. 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. This Laravel Nova field allows you to manage translated fields with astrotomic/laravel-translatable, also with a CKEditor WYSIWYG. This will allow the package to use the translator/app locale instead of the hardcoded one. 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. 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. 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. Because in foreach loop l have query to database it`s a bad. Please make sure you have run php artisan vendor:publish --provider="Astrotomic\Translatable\TranslatableServiceProvider" and that the locales Astrotomic / laravel-translatable Public. Inspired by spatie/laravel-translatable, another alternative for the translation package for your Laravel application. 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 . Thanks! Astrotomic / laravel-translatable Public. 10 will generate: Here is the statement that V11. 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. Contribute to Astrotomic/laravel-translatable development by creating an account on GitHub. Sign up for GitHub By And does your category model use the Translatable trait? This is a Laravel package for translatable models. 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. I have a question about timestamps. . I actually never had to use that when() function and realized that this is a quite nice solution. however unifying usage would really be good. Description: Adding the ability to wrap multiple translations when creating new records. The package overrides the setAttribute() and getAttribute() methods to allow direct access to translated attributes from the main model. 17, filame Astrotomic / laravel-translatable by Gummibeer. Pre You signed in with another tab or window. Notifications You must be signed in to change notification settings; Fork 155; Star 1. Notifications Fork 144; Star 1. Example: SomeModel::all(); The problem is that I can Laravel 9; aAtrotomic/Laravel-translatable: 11. 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. diglactic/laravel A Laravel package for multilingual models. After running php artisan migrate:fresh --seed or php artisan db:seed page is created but no translations are saved to the database. I wonder if there is an option that I'm missing to ignore the second condition, or the package needs a small improvement. Its goal is to remove the complexity in retrieving and storing multilingual model instances. They should be added to the GitHub action test matrix. Hi, I'm trying to get this package working in Lumen. 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. composer require astrotomic/laravel-translatable. Navigation Menu Toggle navigation. 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. 1; We use this package with Spatie/Querybuilder package. See more configuration examples of the Filament panel in GalaxyStore - demo project with Filament, Astrotomic package and more. Astrotomic / laravel-translatable Public. Pick a username Email Address Password You signed in with another tab or window. 2k. 11 in the same project to make sure the version of the Laravel framework is the same. 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. 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. 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. Multi-Language Laravel 11: All You Need to Know. 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. 50. 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. Saved searches Use saved searches to filter your results more quickly You signed in with another tab or window. 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). Expected behavior You signed in with another tab or window. If you contribute to my forest you’ll be creating employment for local families This is the update method in my controller. Discuss code, ask questions & collaborate with the developer community. Reload to refresh your session. 12 (since we need Laravel 10 support) our translations are broken. This is the update method in my controller. 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. Hi thank you for the wonderful package. The content column can contain more than 10,000 characters. 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. 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. 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. If 10 rows, it's 1 sql for my product table, 10 sql for product_relations table. The user fills the table, and the translations will be updated accordingly (if they leave it empty, then no translation for that language. Describe the bug Doesn´t save model translations. Describe the bug when I place a column name in translatedAttributes array no longer can store into that column. 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. 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. Sign up for GitHub By clicking “Sign up Hi there, I have a transation_locales table where are all awailable languages for application. The current Laravel validation doesn't inherently support this functionality, prompting the need for custom solutions. 17/18 · astrotomic/laravel-translatable. But if I use laravel's default's with() You signed in with another tab or window. In this case I would rename it to author_id. The array $translatedAttributes Translatable is fully compatible with all kinds of Eloquent extensions, including Ardent. A Laravel package for multilingual models 20 . This is the correct behavior. My application is used by different users using different locale. With this package you write less code, as the translations are being The translatable model Post should use the trait Astrotomic\Translatable\Translatable. 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. You signed out in another tab or window. i have Get an instance of the translation model. The project I am currently working on is available in de and de-AT. 5), the translated attributes are not saved in the database when using mass update. But you could use multiple with a different set of locales and rules and merge the resulting Arrays. This is a Laravel package for translatable models. It’s now common knowledge that one of the best tools to tackle the climate crisis and keep our temperatures from rising above 1. Then every model have its own xmodel_translations table where model translations are stored. Describe the bug When using the correct version of the package for Laravel 5. Anyway, any package should not affect to another workflow of the application. Code; Issues 19; Pull requests 1; Discussions; Actions; Security; Insights New A Laravel package for multilingual models. Code; Issues 15; Pull probably due to the abstraction that laravel-translatable does. 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. if I use all() then it could be an issue. The idea is that in my view I have a table, one row for each language. LOWER(name) which obviously doesn't work. Contribute to spatie/laravel-translatable development by creating an account on GitHub. Some of them can be deleted by softDelete. Changes: Added translations_wrapper config to allow user to set a custom wrapper name. To Reproduce Hi friends!, I want to use join when script getting the translations. Hey, with one rule factory it isn't. 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. 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. 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. At the end you will have to add/merge your rules manually. Sign in Product Here's our situation, our fallback_locale is DE. product_translations. article_translations contains two translatable columns title and 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. Most of them will be for Laravel - but sometimes Interface. 11 is a lot more complicated. I have the following: Cache::tags(['food', 'food-products'])->rememberForever('non-empty This repo can be used to scaffold a Laravel package. Depends on your table structure, the reason for the relation and so on. json & GitHub action test matrix & readme/docs. 12 for multi language (I mean different text data in database, not just labels on site pages) site where I also usefilament 2. 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. Then the following figure is the query statement that V11. Package Data; Maintainer Username: Gummibeer: Maintainer Contact: gummibeer@astrotomic. The default convention for the translation model is PostTranslation. Instead a new record is created. Sign up for GitHub By use \ Astrotomic \ Translatable \ You signed in with another tab or window. {"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. Copy php artisan vendor: The translatable model Post should use the trait Astrotomic\Translatable\Translatable. After this you can generate the po files and the proper header with artisan trans:po. calebporzio/parental: A parent-child relationship for Eloquent models. Hey guys, i have the problem that my orderByTranslation is getting ignored. 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. If you’ve found a astrotomic/laravel-translatable: Handles translations for Eloquent 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. All reactions. How do I migrate my existing table to use This is a Laravel package for translatable models. PHP8. 😉 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. So let's assume we have posts and post_translations table. 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. You switched accounts on another tab or window. 3 are supported but not part of the test matrix right now. With this package you write less code, as the translations are being fetched/saved when you fetch/save your instance. 2 & 8. Yes, I have read it some times and try to learn more about laravel validation but it's not lucky for me. 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. With this package you write less This is a Laravel package for translatable models. 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. Example You signed in with another tab or window. I need to write a withTranslations() for each query. 19 app I use astrotomic/laravel-translatable 11. 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. With the withTrashed scope I can update my (soft)deleted records. Reply to this email directly, view it on GitHub <#162 (comment)>, or (dimsav/translatable), however it's read only. 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. 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. Hi, First I want to thank you for the nice library. 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. Right now some GitHub actions are failing - they should be fixed to work again. This package relies on a separate DB table to contain all of your localized model This is a Laravel package for translatable models. I tested v11. slide_id is not null` ) is un-neccessary. 10 and v11. Describe the bug I created a seeder with example translations for Page model. Is there a way in which i can change the fallback locale of translation as per the model instead of a global configuration. I have a problem, we need eager load ONLY. That is right as long as the workflow doesn't touch the package. 12. 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. 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. Laravel 9; aAtrotomic/Laravel-translatable: 11. I'm supposed to write mostly in French, but some articles in English. Describe the solu Astrotomic / laravel-translatable Public. 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. Notifications Fork 142; Star 1. svnbls wel svn fieiy hywzfn pvwi rxa tjrvrc oqpdf zifki