Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

aleksandar-radev's avatar

How to add new translations to production app

Currently I am creating a migration for every new translation. Be it a single word, it still goes in a migration. The problem is that after around 2 years, there are just too many migrations. (this also slows down testing, as tests have to run all migrations). The reason it is done in a new migration and not directly in a file, is because the translations can be managed from the frontend. I am using i18n and there is a db table with all translations.

			$translations = app(I18nRepository::class)->all()->first()->literals;
            
            Arr::set($translations, 'Homepage.hello', 'Hello');
            
            $translations ->save();

This is how I add new ones. I also add the translations to a seeder. Is there any better approach to this? How can I make this run only once in production environment?

0 likes
0 replies

Please or to participate in this conversation.