Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚀 Version 1.0 Release: Inertia Stack, Google Translation, and More! 🎉 #50

Merged
merged 13 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2
indent_size = 2
54 changes: 54 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
module.exports = {
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:vue/vue3-recommended",
"plugin:tailwindcss/recommended",
"prettier"
],
plugins: ["unused-imports"],
rules: {
"vue/component-tags-order": [
"error",
{
order: ["script", "template", "style"]
}
],
"vue/multi-word-component-names": "off",
"vue/component-api-style": ["error", ["script-setup", "composition"]],
"vue/component-name-in-template-casing": "error",
"vue/block-lang": [
"error",
{
script: { lang: "ts" }
}
],
"vue/define-macros-order": [
"warn",
{
order: ["defineProps", "defineEmits"]
}
],
"vue/define-emits-declaration": ["error", "type-based"],
"vue/define-props-declaration": ["error", "type-based"],
"vue/match-component-import-name": "error",
"vue/no-ref-object-destructure": "error",
"vue/no-unused-refs": "error",
"vue/no-useless-v-bind": "error",
"vue/padding-line-between-tags": "warn",
"vue/prefer-separate-static-class": "error",
"vue/prefer-true-attribute-shorthand": "error",
"vue/no-v-html": "off",

"tailwindcss/no-custom-classname": "off",

"no-undef": "off",
"no-unused-vars": "off",
"no-console": ["warn"]
},
ignorePatterns: ["*.d.ts"],
parser: "vue-eslint-parser",
parserOptions: {
parser: "@typescript-eslint/parser"
}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea
.env
.phpunit.result.cache
build
composer.lock
Expand All @@ -9,4 +10,6 @@ phpstan.neon
testbench.yaml
vendor
node_modules
resources/dist/hot
.DS_Store
.phpunit.cache
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
auto-imports.d.ts
components.d.ts
generated.d.ts
routes.d.ts
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"tabWidth": 4,
"semi": false,
"bracketSameLine": true,
"printWidth": 500,
"singleAttributePerLine": false,
"singleQuote": false,
"plugins": ["prettier-plugin-tailwindcss"]
}
12 changes: 7 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ Once finished, proceed to install Node dependencies. Run the command:
```shell
npm install
```
or
```shell
yarn install
```

### 📌 Step 3

Expand All @@ -46,7 +50,7 @@ git checkout -b feature/feature-name

Now, you can work on this newly created branch.

> 💡 Tip: While developing, you may run the command `npm run watch` to automatically rebuild any CSS and JavaScript files.
> 💡 Tip: While developing, you may run the command `vite` to automatically rebuild any CSS and JavaScript files.


### 📌 Step 4
Expand All @@ -71,11 +75,9 @@ In your Laravel application, modify the `composer.json` adding a `repositories`

This will instruct composer to install Laravel Translations UI from your local folder instead of using the version on the official repository.

Example:
Example: `composer.json`

```json
// File: composer.json

{
"require": {
"outhebox/laravel-translations": "*"
Expand All @@ -98,7 +100,7 @@ If you changed any CSS or JavaScript files, you must build the assets for produc
Run the command:

```shell
npm run production
vite build
```

### 📌 Step 7
Expand Down
102 changes: 53 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<p align="center">
<img src="https://user-images.githubusercontent.com/44909285/201471525-be424567-47a4-495d-a9b1-cd673cff0b23.svg" alt="Logo Laravel-Translations">
</p>
![Cover](art/cover.png)

<p align="center">
<a href="#introduction">Introduction</a> |
<a href="#roadmap">Roadmap</a> |
<a href="#installation">Installation</a> |
<a href="#usage">Usage</a> |
<a href="#authorization">Authorization</a> |
<a href="#upgrading">Upgrade</a> |
<a href="#roadmap">Roadmap</a> |
<a href="#changelog">Changelog</a>
</p>

Expand All @@ -20,43 +17,72 @@
<a href="https://packagist.org/packages/outhebox/laravel-translations"><img src="https://img.shields.io/badge/Laravel-10.x-brightgreen.svg" alt="Laravel Version"></a>
</p>

![Cover](https://user-images.githubusercontent.com/44909285/201598702-5bcd47ed-6202-41a1-af4a-40203b3b76ae.png)

### Introduction

Laravel Translations UI is a package that provides a simple and friendly user interface for managing translations in a Laravel app. With this package, you can easily add, edit, delete, and export translations, and use the search function to find specific translations.
Laravel Translations UI package provides a user-friendly interface for managing translations in your Laravel application. It simplifies tasks such as adding, editing, deleting, and exporting translations. The package also includes a handy search feature and the ability to invite collaborators for easy translation management. Currently, the package is integrated with the Google Translate API, allowing you to translate your content into any language of your choice.

> 📺 **[Watch a 4-minute video by Povilas Korop](https://www.youtube.com/watch?v=lYkgXnwnVbw)** showcasing the package.

### Requirements

- PHP 8.1 or higher
- Laravel 10.x or higher
- PHP `8.1` or higher
- Laravel `v10.x` or higher

#### Features
### Features
- Easily view, create, and delete translations with an intuitive interface.
- Effortlessly manage translation keys for organized language management.
- Conveniently filter by translation keys or values to quickly locate specific content.
- Seamlessly import and export translations to and from your Laravel application
- Utilize a powerful search function to swiftly find the translations, keys, or values you need.
- Collaborate seamlessly by inviting contributors to manage translations collaboratively.
- Benefit from Google Translate API integration for accurate and automated language translation.
- Explore additional features that enhance your translation workflow and more.

- View, create, and delete translations
- Manage translation keys
- Filter by translation keys or values
- Import and export translations
- Search function to find specific translations
- and more...
### Roadmap
- [x] Add tests.
- [x] Improve the UI.
- [ ] Vendor translations support.
- [x] Google Translate API integration.
- [x] Invite collaborators to manage translations.
- [ ] Add revision history.
- [ ] Add more features.

### Installation

To install Laravel Translations UI in your Laravel project, run the following command:
🚨 **Important Notice: Breaking Changes in this Version** 🚨

I would like to inform you that this version brings about substantial breaking changes, as the package stack has transitioned from [Livewire](https://livewire.laravel.com/) to [Inertia](https://inertiajs.com/). This adjustment brings several improvements and optimizations, enhancing the overall performance and user experience.

To seamlessly adapt to these changes, please follow the steps below:

#### Uninstall the Previous Version
I've added a new command to help you uninstall the package and remove all its assets and configuration files and clean up the database, but please make sure to double-check that everything has been removed before proceeding with the installation of the new version, as this command is still in beta. To uninstall the package, run the following command:

```bash
php artisan translations:clean
```

Alternatively, you can manually remove the package by following these steps:

```bash
composer remove outhebox/laravel-translations
```

#### Install from Scratch

After uninstallation, perform a fresh installation of the package.

```bash
composer require outhebox/laravel-translations
```

Before you can import translations, you'll need to migrate your database. Run the following command to do so:
Before you can access the translations UI, run the migrations by running the following command:

```bash
php artisan migrate
```

After installing the package, you'll need to publish its assets by running the following command:
After running the migrations, you'll need to publish the package's assets by running the following command:

```bash
php artisan translations:install
Expand All @@ -76,35 +102,22 @@ To import and overwrite all previous translations, use the following command:
php artisan translations:import --fresh
```

To access the translations UI, visit /translations in your browser. If you are using a production environment, you will need to login to your application before accessing the translations UI.
To access the translations UI, visit `/translations` in your browser. If you are using a production environment, you will need to create owner user first. To do so, run the following command:

```bash
php artisan translations:contributor
```

You can customize the authorization gate in the configuration file to control access to the translations UI in non-local environments. For more information, see for more details [Authorization](#authorization).
This command will prompt you to enter the user's name, email, and password. Once you have created the owner user, you can log in to the translations UI dashboard and start managing your translations.

#### Exporting Translations

To export your translations, run the following command:
You can export your translations from the translations UI dashboard or by running the following command:

```bash
php artisan translations:export
```

### Authorization

By default, the Translations UI dashboard can only be accessed in the local environment. The authorization gate in the `app/Providers/TranslationsServiceProvider.php` file controls access to the Translations UI dashboard in non-local environments. You can modify this gate as needed to restrict access to your Translations UI installation.

To customize the authorization gate, you can define a closure in the gate method of the TranslationsServiceProvider class:

```php
protected function gate()
{
Gate::define('viewLaravelTranslationsUI', function ($user) {
return in_array($user->email, [
// return true or false based on your authorization logic
]);
});
}
```

### Upgrading

When upgrading to a new major version of Laravel Translations UI, it's important that you carefully review the upgrade guide.
Expand All @@ -127,15 +140,6 @@ To keep the assets up-to-date and avoid issues in future updates, you may add th
}
```

### Roadmap
- [ ] Add tests.
- [ ] Improve the UI.
- [ ] Vendor translations support.
- [ ] Google Translate API integration.
- [ ] Invite collaborators to manage translations.
- [ ] Add revision history.
- [ ] Add more features.

### Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
Expand Down
Binary file added art/cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 27 additions & 18 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"laravel-translations",
"translations",
"localization",
"livewire",
"inertiajs",
"inertia",
"translation-manager"
],
"homepage": "https://github.com/MohmmedAshraf/laravel-translations",
Expand All @@ -19,32 +20,40 @@
}
],
"require": {
"php": "^8.1|^8.2",
"php": "^8.1",
"based/momentum-lock": "^0.2.0",
"based/momentum-modal": "^0.2.0",
"brick/varexporter": "^0.3.7",
"livewire/livewire": "^3.0",
"outhebox/blade-flags": "^1.0",
"saade/blade-iconsax": "^1.0",
"wire-elements/modal": "^2.0",
"wireui/wireui": "^1.18"
"illuminate/contracts": "^9.28|^10.0",
"inertiajs/inertia-laravel": "^0.6.11",
"spatie/laravel-package-tools": "^1.0",
"spatie/laravel-query-builder": "^5.7",
"stichoza/google-translate-php": "^5.1",
"tightenco/ziggy": "^1.8"
},
"require-dev": {
"laravel/pint": "^1.0",
"orchestra/testbench": "^6.0|^7.6|^8.0",
"nunomaduro/collision": "^7.0",
"orchestra/testbench": "^8.0",
"pestphp/pest": "^2.18",
"pestphp/pest-plugin-laravel": "^2.2",
"pestphp/pest-plugin-livewire": "^2.1",
"phpunit/phpunit": "^9.5|^10.0"
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^10.0"
},
"autoload": {
"psr-4": {
"Outhebox\\LaravelTranslations\\": "src",
"Outhebox\\LaravelTranslations\\Database\\Factories\\": "database/factories",
"Outhebox\\LaravelTranslations\\Database\\Seeders\\": "database/seeders"
}
"Outhebox\\TranslationsUI\\": "src",
"Outhebox\\TranslationsUI\\Database\\Factories\\": "database/factories",
"Outhebox\\TranslationsUI\\Database\\Seeders\\": "database/seeders"
},
"files": [
"src/helpers.php"
]
},
"autoload-dev": {
"psr-4": {
"Outhebox\\LaravelTranslations\\Tests\\": "tests"
"Outhebox\\TranslationsUI\\Tests\\": "tests"
}
},
"scripts": {
Expand All @@ -64,10 +73,10 @@
"extra": {
"laravel": {
"providers": [
"Outhebox\\LaravelTranslations\\LaravelTranslationsServiceProvider"
"Outhebox\\TranslationsUI\\TranslationsUIServiceProvider"
],
"aliases": {
"LaravelTranslations": "Outhebox\\LaravelTranslations\\Facades\\LaravelTranslations"
"TranslationsUI": "Outhebox\\TranslationsUI\\Facades\\TranslationsUI"
}
}
},
Expand Down
Loading