# app.SourceLanguage — the language the app is written in

> `app.SourceLanguage = "es";` says the app's own text is written in Spanish. The page's `<html lang>` then says `es` when no translation is served, `App.Languages` starts with `es`, and English is offered only when the app ships its own English file (`locales/en.osy`). Without it an app is written in English, as before.

<!-- id: i18n-source-language · area: i18n · stability: stable · html: https://osysharp.com/reference/i18n/source-language/ -->

## Summary        {#summary}
An app's own words — every `Text("…")`, label, title and message in its source — are written in one language. That is
English unless the app says otherwise, once, beside its culture:

```osy syntax
app.SourceLanguage = "es";      // the words in this app's source are Spanish
app.DefaultCulture = "es-ES";   // …and numbers, money and dates are formatted the Spanish way
```

## Signature      {#signature}
```osy syntax
app.SourceLanguage = "<language tag>";   // "es", "sv", "de", "pt-BR" — a string literal; default "en"
```

A value that is not a language tag in a string is a compile error at its line, in `osy validate` and the compile alike.

## Description    {#description}
**What it changes.**

| | without it | `app.SourceLanguage = "es"` |
|---|---|---|
| `<html lang>` when no translation is served | `en` | `es` |
| `App.Languages` | `["en", …translations]` | `["es", …translations]` |
| a browser that asks for English | is given the source text, labelled `en` | is given the source text, labelled `es` — unless the app ships English |
| `Session.Language` with nothing chosen | `en` | `es` |
| a `[Translatable]` value read in this language | the stored value | the stored value (it is the source) |

**English is a translation like any other.** An app written in Spanish speaks only Spanish until it ships its own
English words — `translations en { … }`, usually in `locales/en.osy` ([A language's words — locales/<language>.osy](https://osysharp.com/reference/i18n/translations/)). Then English is offered,
chosen by the browser, the reader's own `[PreferredCulture]` or a switch exactly as any other language is
([Which language a reader gets — and switching it](https://osysharp.com/reference/i18n/language/)).

**A kit's words in the source language.** The kits are written in English. A Spanish app that wants their buttons and
messages in Spanish translates them in its own `locales/es.osy` (`osy translate` writes the entries, marked with each
kit's name). Those are used whenever the reader's language is the source.

**Not the culture.** `app.DefaultCulture` decides how numbers, money and dates are written ([Culture formatting — ToString(format, culture)](https://osysharp.com/reference/stdlib/culture-formatting/));
`app.SourceLanguage` decides which language the words are. A Spanish app usually sets both.

## Examples       {#examples}
```osy title="an app written in Spanish" test app=i18n-source-language
app.SourceLanguage = "es";

[Route("/")]
[AllowAnonymous]
component Inicio() {
  render {
    Stack(gap: 2) {
      Text("Tu cesta está vacía.");
      Text(Session.Language);          // "es" — the source, until the app ships another language
    }
  }
}
```

```osy title="…and English offered, once the app ships its English words" test app=i18n-source-language-en
app.SourceLanguage = "es";

[Route("/")]
[AllowAnonymous]
component Inicio() { render { Text("Tu cesta está vacía."); } }

translations en {
  text "Tu cesta está vacía." => "Your bag is empty.";
}
```

## See also       {#see-also}
- [Which language a reader gets — and switching it](https://osysharp.com/reference/i18n/language/) — which language a reader gets, and switching it
- [A language's words — locales/<language>.osy](https://osysharp.com/reference/i18n/translations/) — the languages an app speaks, and its locale files
- [Culture formatting — ToString(format, culture)](https://osysharp.com/reference/stdlib/culture-formatting/) — `app.DefaultCulture`, the culture numbers and dates are written in
