Skip to content

Commit

Permalink
Merge pull request #1 from Delta-Solutions/suggestion
Browse files Browse the repository at this point in the history
Cleaned up first version
  • Loading branch information
andreaslauwers1 committed Apr 7, 2023
2 parents a158739 + a96710b commit c6f90f4
Show file tree
Hide file tree
Showing 26 changed files with 36 additions and 457 deletions.
66 changes: 0 additions & 66 deletions .github/ISSUE_TEMPLATE/bug.yml

This file was deleted.

11 changes: 0 additions & 11 deletions .github/ISSUE_TEMPLATE/config.yml

This file was deleted.

12 changes: 0 additions & 12 deletions .github/dependabot.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/dependabot-auto-merge.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/fix-php-code-style-issues.yml

This file was deleted.

26 changes: 0 additions & 26 deletions .github/workflows/phpstan.yml

This file was deleted.

51 changes: 0 additions & 51 deletions .github/workflows/run-tests.yml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE.md
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) Delta-Solutions <andreas@deltasolutions.be>
Copyright (c) Delta-Solutions <info@deltasolutions.be>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
50 changes: 10 additions & 40 deletions README.md
@@ -1,19 +1,7 @@
# This is my package translations
# Translation loader

[![Latest Version on Packagist](https://img.shields.io/packagist/v/delta-solutions/translations.svg?style=flat-square)](https://packagist.org/packages/delta-solutions/translations)
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/delta-solutions/translations/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/delta-solutions/translations/actions?query=workflow%3Arun-tests+branch%3Amain)
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/delta-solutions/translations/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/delta-solutions/translations/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/delta-solutions/translations.svg?style=flat-square)](https://packagist.org/packages/delta-solutions/translations)
This package provides a migration and a model to extend the spatie/laravel-translation-loader so you can use columns for your labels. One column per locale.

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

## Support us

[<img src="https://github-ads.s3.eu-central-1.amazonaws.com/translations.jpg?t=1" width="419px" />](https://spatie.be/github-ad-click/translations)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

## Installation

Expand All @@ -23,43 +11,25 @@ You can install the package via composer:
composer require delta-solutions/translations
```

You can publish and run the migrations with:

```bash
php artisan vendor:publish --tag="translations-migrations"
php artisan migrate
```
Follow the installation steps as explained in the Spatie docs https://github.com/spatie/laravel-translation-loader

You can publish the config file with:
Define the locales in the `translation-loader.php` config file, one locale per database column. This is used in the migration to create the database fields.

```bash
php artisan vendor:publish --tag="translations-config"
```

This is the contents of the published config file:

```php
return [
];
'locales' => ['nl', 'fr', 'en', 'de']
```

Optionally, you can publish the views using
You can publish and run the migrations with:

```bash
php artisan vendor:publish --tag="translations-views"
php artisan vendor:publish --tag="translations-migrations"
php artisan migrate
```

## Usage
Use the model from this package as the model for the spatie/laravel-translation-loader. This is configured via the `model` in the config. Change it to

```php
$translations = new DeltaSolutions\Translations();
echo $translations->echoPhrase('Hello, DeltaSolutions!');
```

## Testing

```bash
composer test
'model' => DeltaSolutions\Translations\Models\LanguageLine::class,
```

## Changelog
Expand Down
14 changes: 3 additions & 11 deletions composer.json
Expand Up @@ -18,19 +18,11 @@
"require": {
"php": "^8.1",
"spatie/laravel-package-tools": "^1.14.0",
"spatie/laravel-translation-loader" : "^2.0",
"illuminate/contracts": "^10.0"
},
"require-dev": {
"laravel/pint": "^1.0",
"nunomaduro/collision": "^7.9",
"nunomaduro/larastan": "^2.0.1",
"orchestra/testbench": "^8.0",
"pestphp/pest": "^2.0",
"pestphp/pest-plugin-arch": "^2.0",
"pestphp/pest-plugin-laravel": "^2.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0"
"laravel/pint": "^1.0"
},
"autoload": {
"psr-4": {
Expand Down Expand Up @@ -69,4 +61,4 @@
},
"minimum-stability": "dev",
"prefer-stable": true
}
}
6 changes: 0 additions & 6 deletions config/translations.php

This file was deleted.

19 changes: 0 additions & 19 deletions database/factories/ModelFactory.php

This file was deleted.

Expand Up @@ -8,12 +8,10 @@ return new class extends Migration
{
public function up()
{
Schema::create('translations_table', function (Blueprint $table) {
$table->id();

// add fields

$table->timestamps();
Schema::table('language_lines', function (Blueprint $table) {
collect(config('translation-loader.locales'))->each(function ($locale) use ($table) {
$table->text($locale);
});
});
}
};
Empty file removed phpstan-baseline.neon
Empty file.

0 comments on commit c6f90f4

Please sign in to comment.