<p>Something like this should work:</p>

<pre><code>Event::on(
        Entry::class,
        Entry::EVENT_AFTER_SAVE,
        function(ModelEvent $event) {
            $entry = $event-&gt;sender;
            $isNew = $event-&gt;isNew;

            if ($isNew) {
                $enEntry = Entry::find()-&gt;id($entry-&gt;id)-&gt;site('enSiteHandle')-&gt;one();
            }
        }
    );
</code></pre>

<p>Just swap out <code>enSiteHandle</code> with your actual English site handle.</p>

CC BY-SA 4.0
2020-06-15T18:05:58.497Z
Thank you for you answer. When I try Entry::find()->id($entry->id) I get an object with NULL values.
Jeroen de Beer
CC BY-SA 4.0
2020-06-16T00:57:31.677Z
You would need to do `Entry::find()->id($entry->id)->one()`
Brad Bell
CC BY-SA 4.0
2020-06-16T08:25:58.747Z
I get NULL if I do this, so I guess this entry does not exist at this point yet.
Jeroen de Beer
CC BY-SA 4.0
2020-06-15T16:59:49.920Z
2020-06-15T16:59:49.920Z
Brad Bell
<p>I'm trying to get some auto translating done in a craft module. In order to do this I need to get the entry of another language in a save event. Is it possible to get this by language?</p>

<pre><code>Event::on(
        Entry::class,
        Entry::EVENT_AFTER_SAVE,
        function(ModelEvent $event) {
            $entry = $event-&gt;sender;
            $isNew = $event-&gt;isNew;

            if ($isNew) {
                $enEntry = $entry-&gt;getEntryByLanguage('en');
            }
        }
    );
</code></pre>

<craft3><language>
Get entry by language in a module
# Get entry by language in a module

(Asked by: username_0 on 2020-06-15)

I'm trying to get some auto translating done in a craft module. In order to do this I need to get the entry of another language in a save event. Is it possible to get this by language?
Event::on(
        Entry::class,
        Entry::EVENT_AFTER_SAVE,
        function(ModelEvent $event) {
            $entry = $event->sender;
            $isNew = $event->isNew;

            if ($isNew) {
                $enEntry = $entry->getEntryByLanguage('en');
            }
        }
    );

**Tags:** craft3, language

---

## 1 answers

### Answer by username_1 on 2020-06-15. Score: 1

Something like this should work:
Event::on(
        Entry::class,
        Entry::EVENT_AFTER_SAVE,
        function(ModelEvent $event) {
            $entry = $event->sender;
            $isNew = $event->isNew;

            if ($isNew) {
                $enEntry = Entry::find()->id($entry->id)->site('enSiteHandle')->one();
            }
        }
    );

Just swap out enSiteHandle with your actual English site handle.

> **Comments:**
> **username_0**: Thank you for you answer. When I try Entry::find()->id($entry->id) I get an object with NULL values.  
> **username_1**: You would need to do `Entry::find()->id($entry->id)->one()`  
> **username_0**: I get NULL if I do this, so I guess this entry does not exist at this point yet.  

---

