定制 seiger/slang 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

seiger/slang

最新稳定版本:v1.0.10

Composer 安装命令:

composer require seiger/slang

包简介

Evocms package for work with Multi lang management for Resource and modules in Evolution CMS. Seiger Lang multi language Management Module for Evolution CMS admin panel. The work of the module is based on the use of the standard Laravel functionality for multilingualism.

README 文档

README

sLang Latest Stable Version CMS Evolution PHP version License Issues Stars Total Downloads

sLang is a robust multilingual Management Module meticulously crafted for the Evolution CMS admin panel. This dynamic package empowers users to seamlessly implement and manage multilingual tools within the Evolution CMS environment. By utilizing Evolution CMS as its platform, sLang offers a streamlined solution for users seeking efficient and intuitive ways to handle diverse language content, making it an indispensable asset for administrators and developers navigating the intricacies of multilingual website management.

The work of the module is based on the use of the standard Laravel functionality for multilingualism. This foundation ensures a reliable and well-established framework for managing multilingual aspects, enhancing the module's performance and aligning it with industry best practices. With its focus on simplicity and integration, sLang emerges as an essential companion for those aiming to enhance the linguistic versatility of their Evolution CMS-powered websites.

Features

  • Automatic Phrase Translation through Google or Custom.
  • Automatic search for translations in templates.
  • Multilingual tabs in resource.
  • Unlimited Translation Language Support.
  • Multilingual SEO Support.

Multilingual tabs

Requirements

  • Evolution CMS 3.3+
  • PHP 8.3+
  • Composer 2.2+
  • One of: MySQL 8.0+ / MariaDB 10.5+ / PostgreSQL 10+ / SQLite 3.25+

Install by artisan package installer

Go to You /core/ folder:

cd core

Run php artisan command

php artisan package:installrequire seiger/slang "*"
php artisan vendor:publish --provider="Seiger\sLang\sLangServiceProvider"

Run make DB structure with command:

php artisan migrate

Usage in blade

Current language:

{{evo()->getConfig('lang')}}
or
{{evo()->getLocale()}}

Default language:

{{evo()->getConfig('s_lang_default')}}

List of frontend languages by comma:

{{evo()->getConfig('s_lang_front')}}

Translation of phrases:

@lang('phrase')

Localized versions of your page for Google hreflang

{!!sLang::hreflang()!!}

Content management

Show current language anywhere with name or shortname

{{Str::upper(sLang::langSwitcher()[evo()->getConfig('lang')]['short'])}}

Implementing a Language Switcher

@foreach(sLang::langSwitcher() as $lang)
    <a href="{{$lang['link']}}">{{Str::upper($lang['ISO 639-1'])}}</a>
@endforeach

Working with localized content (Eloquent)

The Seiger\sLang\Models\sLangContent model now applies the current locale automatically.

  • Fetch translated rows for the active locale:
    use Seiger\sLang\Models\sLangContent;
    
    $items = sLangContent::active()->get(); // locale resolved via evo()->getLocale()
  • Select a specific locale explicitly:
    $items = sLangContent::lang('en')->get();
  • Include template variables while keeping the locale filtering:
    $items = sLangContent::withTVs(['color', 'price'])->get();
  • Combine multiple helpers:
    $items = sLangContent::lang('uk')
        ->withTVs(['color', 'price'])
        ->whereParent($parentId)
        ->active()
        ->get();
  • Legacy helper is preserved for backward compatibility:
    $items = sLangContent::langAndTvs('en', ['color', 'price'])->get();

    Deprecated: langAndTvs() is deprecated since 1.0.8 and is scheduled for removal in v1.2. Use lang()->withTVs() instead.

See full documentation here

统计信息

  • 总下载量: 192
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2022-10-15