Git Product home page Git Product logo

Comments (16)

dimsav avatar dimsav commented on July 26, 2024

Comming soon. Stay tuned!

from laravel-translatable.

plmarcelo avatar plmarcelo commented on July 26, 2024

Hello Dimitious,

When are you planning to release it? Just to know, because have a project that I'm migrating to v5.0, and this is one of the packages that I'm waiting for. If there is something that can help, just let me know it.

Thank you and best regards,
Pedro

from laravel-translatable.

dimsav avatar dimsav commented on July 26, 2024

Hello folks,

I created a laravel 5 branch of this package. Can you try it and tell me how it works?

from laravel-translatable.

plmarcelo avatar plmarcelo commented on July 26, 2024

Hi,

Right now I'm testing it, but I'm dealing with an error "Trait 'Dimsav\Translatable\Translatable' not found". But I keep trying, because I just imported a little portion of my project and maybe is my fault the error.

Thank you and Best Regards,
Pedro

from laravel-translatable.

plmarcelo avatar plmarcelo commented on July 26, 2024

Sorry,

As I installed it from git, had to add the package path to autoload. Now continue testing it.

Best Regards and thank you
Pedro

from laravel-translatable.

dimsav avatar dimsav commented on July 26, 2024

Thanks for the info. I will check the autoloading issue and keep you up to date

from laravel-translatable.

plmarcelo avatar plmarcelo commented on July 26, 2024

Hello,

For me it is working very well. I was having another issue, but was related to my key field name that is language_id. But I overwrited it in the model and everything now works fine.

Best regards and thank you

from laravel-translatable.

dimsav avatar dimsav commented on July 26, 2024

@plmarcelo thanks for the feedback.

@nWidart please write here if you have any issues with L5.

from laravel-translatable.

nWidart avatar nWidart commented on July 26, 2024

For what I've tested until now:

  • The getters work fine $model->property

  • The mass assignment setters do not work. Ie:

    $model->create([
       'fr' => ['name' => 'Grèce'],
       'en' => ['name' => 'Greek'],
    ]);
    

    I had to loop over the properties in the different languages.

from laravel-translatable.

plmarcelo avatar plmarcelo commented on July 26, 2024

Hi, I did this and it worked fine for me:

$data = array(
    'show_order' => 4,
    'en'  => array('label' => 'Category 4'),
    'es'  => array('label' => 'Categoría 4'),
);

$category = FaqCategory::create($data);

Maybe, you have a required field on main table and you are not filling it. Could be?

from laravel-translatable.

nWidart avatar nWidart commented on July 26, 2024

Hm I don't think so. I'll give it another shot tonight and give a heads up here.

from laravel-translatable.

nWidart avatar nWidart commented on July 26, 2024

This is my raw data:
screen shot 2014-09-30 at 08 24 29 pm

Now with this, doing $category->update($data) returns preg_replace(): Parameter mismatch, pattern is a string while replacement is an array .
Same with Category::create($data).

My Category model:

<?php namespace Modules\Blog\Entities;

use Dimsav\Translatable\Translatable;
use Illuminate\Database\Eloquent\Model;

class Category extends Model
{
    use Translatable;

    public $translatedAttributes = ['name', 'slug'];
    protected $fillable = ['name', 'slug'];

    public function posts()
    {
        return $this->belongsToMany('Post');
    }
}

My Category translation model:

<?php namespace Modules\Blog\Entities;

use Illuminate\Database\Eloquent\Model;

class CategoryTranslation extends Model
{
    public $timestamps = false;
    protected $fillable = ['name', 'slug'];
}

from laravel-translatable.

plmarcelo avatar plmarcelo commented on July 26, 2024

You should be having any other problem, I reproduced your models and it works fine for me. What are you tables fields?

My Models

<?php namespace Gnikoob\Models;

use Dimsav\Translatable\Translatable;
use Illuminate\Database\Eloquent\Model;

/*
Table fields
id INT(11) NOT NULL AUTO_INCREMENT,
*/
class Category extends Model {

    use Translatable;

    public $translatedAttributes = ['name', 'slug'];
    protected $fillable = ['name', 'slug'];

    public $timestamps = false;
}

Translation model:

<?php namespace Gnikoob\Models;

use Illuminate\Database\Eloquent\Model;

/*
Table fields
category_id INT(11) NOT NULL,
locale CHAR(2) NOT NULL,
name VARCHAR(100) NOT NULL,
slug VARCHAR(100) NOT NULL,
*/
class CategoryTranslation extends Model {

    protected $fillable = ['name', 'slug'];

    public $timestamps = false;

}

Route file for testing:

Route::get('/', function ()
{
    $data = [
        '_method' => 'PUT',
        '_token'  => 'lkasndnfakjsdhnfklaksdmnfaisubdnflajnsdf',
        'en'      => ['name' => 'Category 2', 'slug' => 'category_2'],
        'es'      => ['name' => 'Categoría 2', 'slug' => 'categoria_2'],
    ];

    $category = \Gnikoob\Models\Category::create($data);

    return $category->translate('en')->name . '(' . $category->translate('en')->slug . ')'; // Category 4
});

The result was this:
Category 2(category_2)

from laravel-translatable.

nWidart avatar nWidart commented on July 26, 2024

Oh, that's weird...
My DB structure looks like this:

Table categories
id INT(10) PRI NOT NULL
created at TIMESTAMP
updated at TIMESTAMP
Table category_translations
id INT(10) PRI NOT NULL
name VARCHAR(255) NOT NULL
slug VARCHAR(255) NOT NULL
category_id INT(10) PRI NOT NULL
locale VARCHAR(255) NOT NULL

from laravel-translatable.

dimsav avatar dimsav commented on July 26, 2024

The issue sounds to be related to #38. Can you please compare your mysql versions?

from laravel-translatable.

dimsav avatar dimsav commented on July 26, 2024

Laravel 5 is now supported in the development branch. If you have any problems please create a new issue.

from laravel-translatable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.