PHPackages                             dinhdjj/laravel-js-localization - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. dinhdjj/laravel-js-localization

AbandonedArchivedLibrary[Localization &amp; i18n](/categories/localization)

dinhdjj/laravel-js-localization
===============================

Give ability to uses laravel's `trans` &amp; `trans\_choice` function in js

v1.0.2(4y ago)0169[2 PRs](https://github.com/divndev/laravel-js-localization/pulls)MITPHPPHP ^8.1

Since May 9Pushed 2y ago1 watchersCompare

[ Source](https://github.com/divndev/laravel-js-localization)[ Packagist](https://packagist.org/packages/dinhdjj/laravel-js-localization)[ Docs](https://github.com/dinhdjj/js-localization)[ RSS](/packages/dinhdjj-laravel-js-localization/feed)WikiDiscussions main Synced 4d ago

READMEChangelog (3)Dependencies (13)Versions (6)Used By (0)

Give ability to uses laravel's `trans` function in js
=====================================================

[](#give-ability-to-uses-laravels-trans-function-in-js)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7be7b9956c109278c05070e4a69a6056077d88fc2d88117c02882d48965cb125/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64696e68646a6a2f6a732d6c6f63616c697a6174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dinhdjj/js-localization)[![GitHub Tests Action Status](https://camo.githubusercontent.com/5433fa660a7e0adde92b851ef5280c98a1580ca08aecddfd8122077309e30695/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f64696e68646a6a2f6a732d6c6f63616c697a6174696f6e2f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/dinhdjj/js-localization/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/385adf1b656b06920aa56ea4642b1da0c8d7539c05ae9b1f2e712bec02972999/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f64696e68646a6a2f6a732d6c6f63616c697a6174696f6e2f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/dinhdjj/js-localization/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/c76039d17fe06d568576874f9fac610125ed09f526e1e5925c70e546640e3f40/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64696e68646a6a2f6a732d6c6f63616c697a6174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dinhdjj/js-localization)

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require dinhdjj/laravel-js-localization
```

Usage
-----

[](#usage)

This package minify step to usage. You just add directive `@jslocalization` to blade layout.

```

>

        @jslocalization

```

And you must remember that when you update this package or update lang files. You should run below command to make it effect

```
    php artisan view:cache
```

If you use typescript below lines will help you

```
type Trans = (key: string, replaces?: Record, local?: string|null) => string;
type TransChoice = (key: string, number: number, replaces?: Record, local?: string|null) => string;

declare global {
    interface Window {
        __: Trans;
        trans: Trans;
        transChoice: TransChoice;
    }
}
```

Finally usage in real life

```
    window.trans('hello :name', {name: 'dinhdjj'});
    window.__('hello :name', {name: 'dinhdjj'});
    window.transChoice('hello :name|xin chao :name', 1,{name: 'dinhdjj'});
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [dinhdjj](https://github.com/dinhdjj)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 53.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

1465d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/47e2161449a748d8324f83eca75917aac149ae95ced37796d72a1da71be7df90?d=identicon)[dileedotdev](/maintainers/dileedotdev)

---

Top Contributors

[![dinwwwh](https://avatars.githubusercontent.com/u/64189902?v=4)](https://github.com/dinwwwh "dinwwwh (16 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (7 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (7 commits)")

---

Tags

laraveldinhdjjjs-localizationlaravel-js-localizationlaravel translaravel trans\_choice

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/dinhdjj-laravel-js-localization/health.svg)

```
[![Health](https://phpackages.com/badges/dinhdjj-laravel-js-localization/health.svg)](https://phpackages.com/packages/dinhdjj-laravel-js-localization)
```

###  Alternatives

[askdkc/breezejp

Laravel Starter Kit (Livewire+Breeze+Laravel UI+Jetstream)や標準のバリデーションメッセージを全て一瞬で日本語化し、言語切替機能も提供するパッケージです / This package provides all-in-one Japanese translation for Laravel StarterKit (Livewire StarterKit, Breeze, Laravel UI and Jetstream) packages and validation messages with language switching feature.

590244.8k1](/packages/askdkc-breezejp)[statikbe/laravel-filament-chained-translation-manager

A translation manager tool for Laravel Filament, that makes use of the Laravel Chained Translator.

92108.7k](/packages/statikbe-laravel-filament-chained-translation-manager)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[elegantly/laravel-translator

All on one translations management for Laravel

6216.9k](/packages/elegantly-laravel-translator)[andrewdwallo/transmatic

Automate and streamline real-time text translations in your Laravel applications

5511.6k](/packages/andrewdwallo-transmatic)[smousss/laravel-globalize

Make Laravel projects translatable in a matter of seconds!

2266.3k](/packages/smousss-laravel-globalize)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
