Voyager 2
2.x
2.x
  • Introduction
  • Javascript
  • Media Manager
  • Plugins
  • Settings
  • bread
    • Actions
    • BREAD Builder
    • Layouts
    • Lists
    • Manipulate data
    • Multilanguage
    • Relationships
    • Validation
    • Views
  • contributing
    • Assets
    • CSS
    • Introduction
  • de
    • index
  • formfields
    • Checkboxes
    • Date & Time
    • Dynamic input
    • Formfields
    • Media Picker
    • Number
    • Password
    • Radios
    • Relationship
    • Repeater
    • Select
    • Simple array
    • Slider
    • Slug
    • Tags
    • Text
    • Toggle
  • getting-started
    • Installation
    • Prerequisites
    • Tips and tricks
    • What is Voyager
  • overriding
    • Overriding formfields
    • Icons
  • plugins
    • Assets
    • Components
    • Features
    • Filter
    • Plugin development
    • Language
    • Menu Items
    • Custom pages
    • Preferences
    • Routes
    • Settings
    • Widgets
Powered by GitBook
On this page

Was this helpful?

  1. plugins

Language

If you want to access your localization strings from inside your Vue components, simply tell Voyager they exist:

<?php

namespace Me\MyPlugin;

use Illuminate\Support\ServiceProvider;
use Voyager\Admin\Facades\Voyager as Voyager;
use Voyager\Admin\Manager\Plugins as PluginManager;

class MyPluginServiceProvider extends ServiceProvider
{
    public function boot(PluginManager $pluginmanager)
    {
        $pluginmanager->addPlugin(\Me\MyPlugin\MyPlugin::class);

        $this->loadTranslationsFrom(realpath(__DIR__.'/../resources/lang'), 'my-plugin');
        Voyager::addTranslations('my-plugin', 'generic');
    }
}

You can now access the strings like __('my-plugin::generic.my-string')

PreviousPlugin developmentNextMenu Items

Last updated 4 years ago

Was this helpful?