Trait for multilingual resource file support

Overview

Usage

This library supports MultilingualResourceTrait which can be used in PluginBase.
Multilingual support of resource files is possible using this trait.
This library uses the language resource name pattern used by PMMP
Therefore, need to name the language resource file according to the established rules

Code of the language according to the ISO_639-3 standard

$resourcePath = "config/%s.yml";  
// Match to:  
// - resources/config/eng.yml  
// - resources/config/kor.yml  
// - resources/config/chz.yml  
// - resources/config/ind.yml  
// - resources/config/jpn.yml  

Example: Support multilingual in config.yml file

use kim\present\traits\multilingual\MultilingualResourceTrait;  

//Example source for saving the config.yml file  
class Main extends PluginBase{  
    use MultilingualResourceTrait;  

    public function saveDefaultConfig() : bool{  
        return $this->saveResourceByLanguage("config.yml", "config/%s.yml");  
    }  
}  

Use MultilingualConfigTrait

use kim\present\traits\multilingual\MultilingualConfigTrait;  

//Example source for saving the config.yml file  
class Main extends PluginBase{  
    use MultilingualConfigTrait;  
}  

API

public function saveResourceByLanguage(string $filename, string $resourcePath, bool $replace = false) : bool  
Param name Description
$filename File save path. It is saved in the plug-in data folder.
$resourcePath Resource file path. It is read from the plugin resource folder.
$replace Whether to overwrite the file

public function getResourceByLanguage(string $path) : ?resource  
Param name Description
$path Resource file path. It is read from the plugin resource folder.
You might also like...
A Laravel package for multilingual models
A Laravel package for multilingual models

Introduction If you want to store translations of your models into the database, this package is for you. This is a Laravel package for translatable m

Searches for multilingual phrases in Laravel project and automatically generates language files for you.
Searches for multilingual phrases in Laravel project and automatically generates language files for you.

Laravel Lang Generator Searches for multilingual phrases in a Laravel project and automatically generates language files for you. You can search for n

Laravel Multilingual Models

Laravel Multilingual Models Make Eloquent model attributes translatable without separate database tables for translation values. Simply access $countr

Lightweight JSON:API resource for Laravel

JSON:API Resource for Laravel A lightweight Laravel implementation of JSON:API. This is a WIP project currently being built out via livestream on my Y

⚙️Laravel Nova Resource for a simple key/value typed setting

Laravel Nova Resource for a simple key/value typed setting Administer your Laravel Simple Setting in Nova Pre-requisites This Nova resource package re

Simply define the permission in the filament resource.

Simply define the permissions in the filament resource. Easily define permissions for Filament Resources & Relation Managers Installation You can inst

This package provides a Filament resource to view all Laravel sent emails.
This package provides a Filament resource to view all Laravel sent emails.

This package provides a Filament resource to view all Laravel outgoing emails. It also provides a Model for the database stored emails. Installation Y

Sebuah aplikasi file hosting sederhana yang berguna untuk menyimpan berbagai file

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Laravel File System Watcher

Lara Inotify is a wrapper for inotify for Laravel to make it easier to watch filesystem and avoid memory leaks.

Owner
PocketMine-MP projects of PresentKim
PocketMine-MP projects of PresentKim
CORS (Cross-Origin Resource Sharing) support for Laravel and Lumen

Description This package adds Cross-Origin Resource Sharing (CORS) support to your Laravel application. The package is based on Framework agnostic (PS

null 48 Feb 1, 2020
Renamify is a package for Laravel used to rename a file before uploaded to prevent replacing exists file which has the same name to this new uploaded file.

Renamify Laravel package for renaming file before uploaded on server. Renamify is a package for Laravel used to rename a file before uploaded to preve

MB'DUSENGE Callixte 2 Oct 11, 2022
Generate and autoload custom Helpers, Builder Scope, Service class, Trait

laravel-make-extender Generate and autoload custom helpers, It can generate multilevel helpers in the context of the directory. Generate Service class

Limewell 30 Dec 24, 2022
This package provides a trait that will generate a unique uuid when saving any Eloquent model.

Generate slugs when saving Eloquent models This package provides a trait that will generate a unique uuid when saving any Eloquent model. $model = new

Abdul Kudus 2 Oct 14, 2021
A Single Table Inheritance Trait for Eloquent/Laravel

Single Table Inheritance Credit This code is a fork of Nanigans/single-table-inheritance. I've only updated it to work with Laravel 5 Single Table Inh

Peter Haza 15 Feb 17, 2022
Trait for Laravel testing to count/assert about database queries

counts_database_queries Trait for Laravel testing to count/assert about database queries Installing composer require ohffs/counts-database-queries-tra

null 1 Feb 23, 2022
A Single Table Inheritance Trait for Eloquent/Laravel

Single Table Inheritance Single Table Inheritance is a trait for Laravel 5.8+ Eloquent models that allows multiple models to be stored in the same dat

Jon Palmer 240 Oct 26, 2022
This package provides a trait to run your tests against a MinIO S3 server.

Laravel MinIO Testing Tools This package provides a trait to run your tests against a MinIO S3 server. ?? Blog post: https://protone.media/en/blog/how

Protone Media 7 Oct 12, 2022
Livewire trait (throttling). Limiting request processing speed

Livewire Throttling Installation You can install the package via composer: composer require f1uder/livewire-throttling Usage Livewire component <?php

Fluder 5 Dec 7, 2022
Get estimated read time of an article. Similar to medium.com's "x min read". Multilingual including right-to-left written languages. Supports JSON, Array and String output.

Read Time Calculates the read time of an article. Output string e.g: x min read or 5 minutes read. Features Multilingual translations support. Static

Waqar Ahmed 8 Dec 9, 2022