Latvian orthography, historically, has used a system based upon German phonetic principles and the Latgalian dialect was written using Polish orthographic principles. The present-day Latvian orthography has been in use since 1908. Its basis is the Latin alphabet. For the most part it is phonetic in that it follows the language's pronunciation.
Today, the Latvian standard alphabet consists of 33 letters.
The modern standard Latvian alphabet uses 22 unmodified letters of the Latin alphabet. The Latvian alphabet lacks Q, W, X and Y. It adds a further eleven letters by adding diacritic marks to some letters. The vowel letters A, E, I and U can take a macron to show length, unmodified letters being short. The letters C, S and Z, that in unmodified form are pronounced [ts], [s] and [z] respectively, can be marked with a caron. These marked letters, Č, Š and Ž are pronounced [tʃ], [ʃ] and [ʒ] respectively. The letters Ģ, Ķ, Ļ and Ņ are written with a cedilla or a small comma placed below (or above the lowercase g). They are modified (palatalized) versions of G, K, L and N and represent the sounds [ɟ], [c], [ʎ] and [ɲ]. Non-standard varieties of Latvian add extra letters to this standard set.
The letters F and H appear only in loanwords.
Historically the letters CH, Ō and Ŗ were also used in the Latvian alphabet. On 5 June 1946, the Latvian SSR legislature passed a regulation on language reform that officially replaced the letter Ŗ with R in print. Similar reforms replacing CH with H, and Ō with O were enacted over the next few years.
The letters CH, Ō and Ŗ continue to be used in print throughout most of the Latvian diaspora communities, whose founding members left their homeland before the post-World War II Soviet-era language reforms. An example of a publication in Latvia today, albeit one aimed at the Latvian diaspora, that uses the older orthography—and hence, also the letters CH, Ō and Ŗ—is the weekly newspaper Brīvā Latvija.
Latvian has a phonetic spelling. There are only three exceptions to this. The first is the letter E and its long variation Ē, which are used to write two sounds that represent the short and long versions of either [ɛ] or [æ] respectively. The letter O indicates both the short and long [ɔ], and the diphthong [ua̯]. These three sounds are written as O, Ō and Uo in Latgalian, and some Latvians campaign for the adoption of this system in standard Latvian. However, the majority of Latvian linguists argue that o and ō are found only in loanwords, with the Uo sound being the only native Latvian phoneme. The digraph Uo was discarded in 1914, and the letter Ō has not been used in the official Latvian language since 1946.
Latvian orthography also uses two digraphs, Dz and Dž respectively.
The old orthography was based on that of German and did not represent the Latvian language phonemically. At the beginning it was used to write religious texts for German priests to help them in their work with Latvians. The first writings in Latvian were chaotic: there were as many as twelve variations of writing Š. In 1631 the German priest Georg (Georgs) Mancelius tried to systematize the writing. He wrote long vowels according to their position in the word — a short vowel followed by h for a radical vowel, a short vowel in the suffix and vowel with a diacritic mark in the ending indicating two different accents. Consonants were written following the example of German with multiple letters. The old orthography was used until the 20th century when it was slowly replaced by the modern orthography.
Lack of software support of diacritics has caused an unofficial style of orthography, often called translit, to emerge for use in situations when the user is unable to access Latvian diacritic marks on the computer or using cell phone. It uses only letter of the ISO basic Latin alphabet, and letters that aren't used in standard orthography are usually omitted. In this style, diacritics are replaced by digraphs;ā, ē, ī, ū - aa, ee, ii, uu
ļ, ņ, ģ, ķ - lj, nj, gj, kj
š - sh (as well as ss, sj, et al.)
Some people may find it difficult to use these unusual methods, so they write without any indication of missing diacritic marks, or they use digraphs only if the diacritic mark in question would make a semantic difference. There exists yet another style, sometimes called "Pokémonism" (In Latvian Internet slang "Pokémon" is derogatory for adolescent), characterised by use of some elements of leet, use of non-Latvian letters (particularly w and x instead of v and ks), use of c instead of ts, use of z in endings, and use of mixed case.
Standard QWERTY keyboards are used for writing in Latvian; diacritics are entered by using a dead key (usually ", occasionally ~). Some keyboard layouts use a modifier key AltGr (most notable of such is the Windows 2000 and XP built-in layout (Latvian QWERTY)). In the early 1990s, the Latvian ergonomic keyboard layout was developed. Although this layout may be available with language support software, it has not become popular because of a lack of keyboards with such a configuration.