# AUR4000

## Error Message

`AUR4000: Translation key not found`

## Description

This error occurs when the i18n system cannot find a translation for the requested key in any of the loaded translation resources. This typically happens when:

1. The translation key doesn't exist in the current locale's translation files
2. The translation files haven't been loaded properly
3. There's a typo in the translation key
4. The fallback locale doesn't contain the key either

## Common Scenarios

### Missing Translation Key

```typescript
// Translation file (en.json)
{
  "welcome": "Welcome",
  "goodbye": "Goodbye"
}

// Template usage
<template>
  <p>${'hello' & t}</p> <!-- AUR4000: 'hello' key doesn't exist -->
  <p>${'welcome' & t}</p> <!-- ✅ Works fine -->
</template>
```

### Typo in Translation Key

```typescript
// ❌ Wrong: Typo in key
<p>${'welcom' & t}</p> <!-- Missing 'e' at the end -->

// ✅ Correct: Proper key
<p>${'welcome' & t}</p>
```

## Solutions

### 1. **Add the Missing Translation Key**

```json
// en.json
{
  "welcome": "Welcome",
  "hello": "Hello",
  "goodbye": "Goodbye"
}
```

### 2. **Verify Translation Files Are Loaded**

```typescript
import { I18N } from '@aurelia/i18n';

export class MyApp {
  constructor(private i18n: I18N) {}
  
  async attached() {
    // Ensure translations are loaded
    await this.i18n.setLocale('en');
  }
}
```

### 3. **Use Fallback Values**

```html
<!-- Provide fallback text -->
<p>${'missing-key' & t : 'Default Text'}</p>
```

### 4. **Check Key Existence Programmatically**

```typescript
export class MyComponent {
  constructor(private i18n: I18N) {}
  
  getTranslation(key: string) {
    if (this.i18n.tr.hasKey(key)) {
      return this.i18n.tr(key);
    }
    return `Missing translation: ${key}`;
  }
}
```

## Debugging Tips

1. **Check Console**: Look for i18n loading errors in browser console
2. **Verify File Structure**: Ensure translation files are in the correct location
3. **Test Key Existence**: Use browser dev tools to check loaded translations
4. **Fallback Locale**: Ensure fallback locale contains all necessary keys


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aurelia.io/developer-guides/error-messages/4000-to-4002/aur4000.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
