---
title: "ArrayTranslator – API-Referenz · Quittio"
description: "Translator backed by PHP array files: {path}/{locale}/{group}.php."
canonical_url: "https://quittio.dev/docs/api/Quittio/Core/I18n/ArrayTranslator"
locale: de
meta:
  "og:description": "Translator backed by PHP array files: {path}/{locale}/{group}.php."
  "og:image": "https://quittio.dev/og/quittio-de.jpg"
  "og:image:alt": "Quittio: E-Rechnungen für PHP und Laravel. Rechtssicher, validiert, archiviert, mit geprüfter Beispielrechnung."
  "og:image:height": "630"
  "og:image:type": image/jpeg
  "og:image:width": "1200"
  "og:title": "ArrayTranslator – API-Referenz · Quittio"
  "twitter:image": "https://quittio.dev/og/quittio-de.jpg"
  "twitter:image:alt": "Quittio: E-Rechnungen für PHP und Laravel. Rechtssicher, validiert, archiviert, mit geprüfter Beispielrechnung."
---

> Index of every page on this site: [llms.txt](https://quittio.dev/llms.txt)

[API reference](https://quittio.dev/docs/api) / [Quittio](https://quittio.dev/docs/api/Quittio) \\ [Core](https://quittio.dev/docs/api/Quittio/Core) \\ [I18n](https://quittio.dev/docs/api/Quittio/Core/I18n)

# ArrayTranslator

final class in quittio/core · implements [`Translator`](https://quittio.dev/docs/api/Quittio/Core/I18n/Translator)

`Quittio\Core\I18n\ArrayTranslator` · [Source](https://github.com/Quittio/quittio/blob/v0.7.1/packages/core/src/I18n/ArrayTranslator.php#L16)

Translator backed by PHP array files: {path}/{locale}/{group}.php.

Keys follow Laravel's convention "namespace::group.key". Paths are registered per namespace; later paths override earlier ones. Missing keys fall back to the language of a regional locale ("de" for "de\_CH"), to the fallback locale and finally to the key itself. Item keys may contain dots (e.g. "de.standard"); a flat key wins over a nested lookup.

## Constants \#

| Constant | Value | Description |
| --- | --- | --- |
| `CORE_NAMESPACE` | `'quittio'` | |

## Methods \#

| Method | Description |
| --- | --- |
| `->__construct()` | |
| `->addPath()` | |
| `->get()` | |
| `->has()` | |
| `::language()` | The language of a regional locale: "de" for "de\_CH" or "de-CH". |
| `->locale()` | |
| `->setLocale()` | |

### `__construct()`#

```
public function __construct(string $locale = 'en', string $fallbackLocale = 'en')
```

| Parameter | Type | Description |
| --- | --- | --- |
| `$locale` | `string` = `'en'` | |
| `$fallbackLocale` | `string` = `'en'` | |

### `addPath()`#

```
public function addPath(string $path, string $namespace = '*'): self
```

| Parameter | Type | Description |
| --- | --- | --- |
| `$path` | `string` | |
| `$namespace` | `string` = `'*'` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

### `get()`#

```
public function get(string $key, array $replace = [], ?string $locale = null): string
```

| Parameter | Type | Description |
| --- | --- | --- |
| `$key` | `string` | |
| `$replace` | `array` = `[]` | |
| `$locale` | `?string` = `null` | |

<dl><dt>Returns</dt>
<dd><code>string</code></dd>
</dl>

### `has()`#

```
public function has(string $key, ?string $locale = null): bool
```

| Parameter | Type | Description |
| --- | --- | --- |
| `$key` | `string` | |
| `$locale` | `?string` = `null` | |

<dl><dt>Returns</dt>
<dd><code>bool</code></dd>
</dl>

### `language()`#

```
public static function language(string $locale): string
```

static

The language of a regional locale: "de" for "de\_CH" or "de-CH".

| Parameter | Type | Description |
| --- | --- | --- |
| `$locale` | `string` | |

<dl><dt>Returns</dt>
<dd><code>string</code></dd>
</dl>

### `locale()`#

```
public function locale(): string
```

<dl><dt>Returns</dt>
<dd><code>string</code></dd>
</dl>

### `setLocale()`#

```
public function setLocale(string $locale): self
```

| Parameter | Type | Description |
| --- | --- | --- |
| `$locale` | `string` | |

<dl><dt>Returns</dt>
<dd><code>self</code></dd>
</dl>

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://quittio.dev/#website","@type":"WebSite","description":"E-Rechnungen für PHP und Laravel: ZUGFeRD, XRechnung und Peppol erstellen, prüfen, lesen und archivieren.","inLanguage":"de-DE","name":"Quittio","url":"https://quittio.dev/","publisher":{"@id":"https://quittio.dev/#identity"},"workTranslation":{"@id":"https://quittio.dev/en#website"}},{"@id":"https://quittio.dev/docs/api/Quittio/Core/I18n/ArrayTranslator#webpage","@type":"WebPage","description":"Translator backed by PHP array files: {path}/{locale}/{group}.php.","name":"ArrayTranslator – API-Referenz","url":"https://quittio.dev/docs/api/Quittio/Core/I18n/ArrayTranslator","isPartOf":{"@id":"https://quittio.dev/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://quittio.dev/docs/api/Quittio/Core/I18n/ArrayTranslator"]}],"primaryImageOfPage":{"@id":"https://quittio.dev/#logo"}},{"@id":"https://quittio.dev/#identity","@type":"Organization","description":"Open-Source-Bibliothek für E-Rechnungen in PHP und Laravel (ZUGFeRD, XRechnung, Peppol) und Quittio Managed.","email":"kontakt@niklasforst.de","legalName":"Niklas Forst – Softwareentwicklung","name":"Quittio","url":"https://quittio.dev","founder":{"@type":"Person","name":"Niklas Forst","url":"https://quittio.dev/ueber"},"logo":{"@id":"https://quittio.dev/#logo"},"sameAs":["https://github.com/Quittio/quittio","https://packagist.org/packages/quittio/quittio"]},{"@id":"https://quittio.dev/#logo","@type":"ImageObject","caption":"Quittio","contentUrl":"https://quittio.dev/logo.png","inLanguage":"de-DE","url":"https://quittio.dev/logo.png"}]}
```