Latvian in western orthography was first written using a system based upon German phonetic principles, while the Latgalian dialect was written using Polish orthographic principles. At the beginning of the 20th century, this was replaced by a more phonetically appropriate system, using a modified Latin alphabet.
Today, the Latvian standard alphabet consists of 33 letters.
The modern standard Latvian alphabet uses 22 unmodified letters of the Latin alphabet (all except Q , W , X and Y ). It adds a further eleven letters by modification. 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 little '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.
Latvian spelling has almost perfect correspondence between graphemes and phonemes. Every phoneme has its own letter so that a reader need not learn how a word is pronounced, but simply pronounce it. There are only three exceptions to this that could cause mispronunciation. 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[uɔ]. 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. Likewise, the letters Ŗ and Ch were discarded in 1957, although they are still used in some varieties and by many Latvians living beyond the borders of Latvia. The letter Y is used only in the Latgalian language, where it is used to write a distinct phoneme that does not occur in other Latvian varieties. Latvian orthography allows nine digraphs, which are written Ai , Au , Ei , Ie , Iu , Ui , Oi , Dz and Dž .
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 Georgs (Juris) Mancelis 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 in today's computerised media (e-mail, newsgroups, web user forums, chat, SMS etc.). It uses the basic Modern Latin alphabet only, and letters that aren't used in standard orthography are usually omitted. In this style, diacritics are replaced by digraphs - a doubled letter indicates a long vowel; j indicates palatalisation of consonants, except for Š , Č and Ž that are indicated by using h . Sometimes the second letter, the one used instead of a diacritic, is changed to one of two other diacritic letters (e.g. š is written as ss or sj, not sh), and since many people may find it difficult to use these unusual methods, they write without any indication of missing diacritic marks, or they use digraphing only if the diacritic mark in question would make a semantic difference. Sometimes an apostrophe is used before or after the character that would properly need to be diacriticised. Also, digraph diacritics are often used and sometimes even mixed with diacritical letters of standard orthography. Although today there is software support available, diacritic-less writing is still widespread for financial and social reasons.
Standard QWERTY keyboards are used for writing in Latvian; diacritics are entered by using a dead key (usually ", occasionally ~). Some keyboard layouts use the modifier key AltGr (most notably 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 this layout.