Git Product home page Git Product logo

Comments (3)

promatik avatar promatik commented on July 30, 2024 1

Hi @kee0624!

Right now Settings doesn't support to have some translatable values.
It is possible to do it for your project, you'll need to replace the current Controller and the current Model.

You can replace Backpack SettingCrudController by doing a bind;

// service provider
public function boot()
{
    $this->app->bind(
        \Backpack\Settings\app\Http\Controllers\SettingCrudController::class, 
        \App\Http\Controllers\SettingCrudController::class
    );
}

Then you'll need to define your Settings Model in the overriden controller, something like this;
(please note this code may have bugs, it's not tested)

namespace App\Http\Controllers;

class SettingCrudController extends \Backpack\Settings\app\Http\Controllers\SettingCrudController
{
    public function setup()
    {
        parent::setup();

        CRUD::setModel(\App\Models\Setting::class);
    }
}

Then on your Model you can set use HasTranslations and set $translatable = ['value'].
Note that this will make value translatable for all the keys.

@kee0624 for now I'll close this issue, but if you have any doubt about this, feel free to to ask ✌

from settings.

welcome avatar welcome commented on July 30, 2024

Hello there! Thanks for opening your first issue on this repo!

Just a heads-up: Here at Backpack we use Github Issues only for tracking bugs. Talk about new features is also acceptable. This helps a lot in keeping our focus on improving Backpack. If you issue is not a bug/feature, please help us out by closing the issue yourself and posting in the appropriate medium (see below). If you're not sure where it fits, it's ok, a community member will probably reply to help you with that.

Backpack communication mediums:

  • Bug Reports, Feature Requests - Github Issues (here);
  • Quick help (How do I do X) - Gitter Chatroom;
  • Long questions (I have done X and Y and it won't do Z wtf) - Stackoverflow, using the backpack-for-laravel tag;

Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or Stackoverflow is thanks to our awesome awesome community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch.

Thank you!

--
Justin Case
The Backpack Robot

from settings.

tabacitu avatar tabacitu commented on July 30, 2024

Hey - just wanted to jump in to say we have no plans to make this package support multi-language settings.
So if anybody needs that, they should roll their own.

One way is what @promatik suggested above.
Another way would be to copy everything from this package into their own project, replace the namespaces, and modify to their liking.

Each with his own 😀

Cheers!

from settings.

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.