PHPackages                             rauwebieten/craft-translations-extractor - 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. rauwebieten/craft-translations-extractor

ActiveCraft-plugin[Localization &amp; i18n](/categories/localization)

rauwebieten/craft-translations-extractor
========================================

Craft CMS Translations Extractor

1.0.2(3y ago)058MITPHPPHP ^7.2.5|^8.0

Since Dec 5Pushed 3y ago1 watchersCompare

[ Source](https://github.com/rauwebieten/craft-translations-extractor)[ Packagist](https://packagist.org/packages/rauwebieten/craft-translations-extractor)[ RSS](/packages/rauwebieten-craft-translations-extractor/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (4)Versions (4)Used By (0)

Translations Extractor plugin for Craft CMS 3.5
===============================================

[](#translations-extractor-plugin-for-craft-cms-35)

WORK IN PROGRESS, USE AT OWN RISK

Requirements
------------

[](#requirements)

This plugin requires Craft CMS 3.5 later.

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

[](#installation)

```
composer require rauwebieten/craft-translations-extractor

```

Usage
-----

[](#usage)

php craft translations-extractor/index

This command will search for translations strings in your templates folder. This command uses a regular expression to find all translation strings, it will find following translation strings:

```

    {# translation with t filter #}
    {{ "Hello world"|t }}

    {# translation with translate filter #}
    {{ "Hello craft"|translate }}

    {# translation with single quotes #}
    {{ 'Hello template'|t }}

    {# translation with single/double quotes #}
    {{ 'This is a "quoted string"'|t }}
    {{ "This is another \"quoted string\""|t }}
    {{ 'This too is a \'quoted string\''|t|raw }}

```

Foreach defined language in your project it will create a translation file.

- Translation string that are not in use anymore, are removed from the translation file
- Existing translations strings are merge with the newly found translations strings

```
translations/en/site-extracted.php

```

Do whatever you like with this file. For example, include it in the main translation file. This way you can still use a site.php file with your custom translation strings.

```
// translations/en/site.php
