アプリ関連ニュース

Laravelの翻訳をテストしました。美しい管理画面付きパッケージ

今回は、パッケージレビューをしたいと思います。
Joedixonのパッケージで、laravel translationsという名前です。翻訳パッケージはたくさんありますが、これはかなりシンプルで強力です。今回はその辺を紹介したいと思います。

取り付けはいたって簡単です。

composer require joedixon/laravel-translation

パブリケーションアセットの場合は、次のように追加します。

php artisan vendor:publish --provider="JoeDixon\Translation\TranslationServiceProvider"

そして、Publishingが完了すると、config/translation.phpという新しいファイルが作成されます。

これは、私の新しく作ったLaravelプロジェクトで、この翻訳ファイルを設定することができます。
我々は、ドライバを変更することができます => file, database
middlewareを追加 => [‘web’, ‘auth’].

インストールが完了したら、artisan serverコマンドを実行し、/languagesを呼び出します。
このページが表示されます。
新しい言語を追加し、既存の言語を編集することができます。

試しに1つだけ言語を変えてみて
ドライバ => file を選択したため、lang/en/auth.phpファイルに影響を与える可能性があります。

そして、この翻訳が公開されているため、ロールを制限することができます。 そのために、認証ミドルウェアを追加することができます。

'route_group_config' => [
        'middleware' => ['web','auth'],
    ],

そして、URLを起動すると、ログインページが表示されることが確認できます。ログイン後、languagesに移動し、/languagesを入力します。

このコマンドは、アプリケーションで利用可能なすべての言語のリストを表示します。

php artisan translation:list-missing-translation-keys

例えば、:
Log in を Hey Log In に変更すると、lang/en.json に影響する可能性があります。

ログインページに移動した後、LOGINをHey Log Inテキストに変更しました。
それは日本語、韓国語などのような他の言語を追加することができます。

おわりに
というわけで、自分でもクライアントでも使いやすいlaravelの翻訳管理パッケージの静かなデモです。 

最後までお読みいただき、ありがとうございました。

By Ami



4 Reasons Why We Need Code Reviews

Code reviews are necessary as they offer multiple benefits that help improve your code and your team. These benefits include:

  • Helping reduce bugs and logic errors
  • Providing an opportunity for training
  • Spreading knowledge across areas and teams
  • Revealing new ideas and techniques

Code reviews help reduce bugs and logic errors

One of the main things a reviewer should be looking for when reviewing code is that the code does the right thing without any errors.

It may seem like it would be hard to find bugs while reading code, but as developers become more experienced reviewing code, issues will start to stand out.

Even with QA and automated testing, finding bugs during a code review is helpful. Reviews help verify the code and tests are both correct. A code review can direct the developer to the exact area of the problem, making it easier to debug and fix. Reviews are just one more step we can use to help avoid stressful after hour bugs.

Reviews offer opportunities for training

We all know how quickly the technology around us changes. there is a new language, tool, or framework every day. We also learn new best practices, standards, and ways to do things as we gain more experience.

How do we keep all the developers on the team up to date with these changes? Of course, there are courses, tutorials, blogs, the team wikis, and guides out there. But do we have time for every developer on our team to always go through a course? Developers should continue to use these resources and learn from them.  However, none of these resources have come close to what we learned by working with the team and having code reviewed. Good code has come from code reviews.

Code reviews spread knowledge across areas and teams

If we had two teams of developers who always worked together and reviewed each other’s code versus two groups of developers who never reviewed the other team’s code, who do you think will have better code in the long run?

It probably will be the teams that review each other’s code. Those two teams will be passing knowledge back and forth about their specific areas and the best way to do things. They will be learning from different experiences and projects.

Code reviews also reveal new ideas and techniques

Reviews will teach the same team new things the same way they will teach multiple teams. But new ideas and techniques often come up in code reviews even among the same team members.

Think about most of the code we write. How often do we research different design patterns, consider different architectures or attempt multiple solutions before deploying code? At most places, we don’t have the time to pair program on everything or always meet about how to code every feature. Once a team implements a review process, these suggestions happen without extra steps.

Tsuki



Flutterで生体認証等を行えるライブラリ local_auth

PINやパスコード認証、生体認証を行うためのFlutter用ライブラリlocal_authをご紹介します。

続きを読む

PHP Zipper package using PHP ZipArchive

Today I would like to share a PHP package that I wrote last weekend. This was written to make Zipping processes easily and automatically using PHP ZipArchive. Let’s take a look.

First of all, install the package with composer.

composer require waithaw/phpzipper

After creating Zip Object, you can use the following methods.

include_once "vendor/autoload.php";

use WaiThaw\PhpZipper\Zip;

$zip = new Zip();


These are the example file lists.

$filelists= [
    'D:\testfolder\test1.txt',
    'D:\testfolder\test1folder\test2.txt'
];

$file = 'D:\testfolder\test1.txt';

Creating a Zip file from Single file or multiple files

You can create an archive zip file from single file or multiple files.

1st parameter – output zip path

2nd parameter – a file or files to be zipped

3rd parameter – setting a password

  • Zipping a single file or mutiple files with no password

$zip->createFromFiles('backup.zip', $file);

//OR

$zip->createFromFiles('backup.zip', $filelists);


  • Zipping a single file or mutiple files with password

$zip->createFromFiles('backup.zip', $file ,'password');

//OR

$zip->createFromFiles('backup.zip', $filelists,'password');


Creating a Zip file from a directory including sub directories.

You can archive all files and subfolders in a directory into a zip file.

  • Zipping a directory with no password

$zip->createFromDir('backup.zip','D:\testfolder');

  • Zipping a directory with password

$zip->createFromDir('backup.zip','D:\testfolder','password');

Extracting a simple or password-protected zip file

  • Extracting a simple zip file.

$zip->extractTo('backup.zip','D:\outputpath');

  • Extracting a password-protected zip file

$zip->extractTo('backup.zip','D:\outputpath', 'password');

Downloading zip files

You can download the zip file at once archiving.

$zip->createFromFiles('backup.zip', $file)->download();

$zip>createFromDir('backup.zip','D:\testfolder')->download();


And you can also delete the zip file after downloaded, by passing ‘delete’ string in download() method.

$zip->createFromFiles('backup.zip', $file)->download('delete');

$zip>createFromDir('backup.zip','D:\testfolder')->download('delete');


This is all for now. I will continue to update this package for more features and details.

Hope you enjoy that.

By Asahi



Github Wrapped

Developers normally code a lot just for a month but think for a year. If we want to see our history of our git commits, PRs, reviews etc through out a year , there is a newly service website called Github Wrapped.

You just need to login your github account and go to this website.

GitHub Wrapped

You may be asked for authorization to use the website from your Github account. After giving authorization this home screen will appear. I used my personal Github account for testing purpose.

Then you just need to go on by clicking the play button, these are my results.

You will also see a bunch of your activities like followers, stars etc.

But for the final result, you will get a pretty home page for your activity history through out the year (2021).

You can even copy/download your final image to save on your disk or share on twitter. I think this is a nice and pretty way to see your Github activity history for a year.

Yuuma



アプリ関連ニュース

お問い合わせはこちら

お問い合わせ・ご相談はお電話、またはお問い合わせフォームよりお受け付けいたしております。

tel. 06-6454-8833(平日 10:00~17:00)

お問い合わせフォーム