Skip to content

Commit 170eb8b

Browse files
committed
More tweaks
1 parent e502b13 commit 170eb8b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

vignettes/locale-sensitive.Rmd

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ knitr::opts_chunk$set(
1616
library(stringr)
1717
```
1818

19-
stringr provides a number of locale-sensitive functions, meaning their behavior depends on your locale, of which your language is a very important part. stringr defaults to English rules, `locale = "en"`, but you can override by providing a different `locale`. A locale is specified by a lower-case language abbreviation, optionally followed by an underscore (_) and an upper-case region identifier. For example, "en" is English, "en_GB" is British English, and "en_US" is American English. For a list of language codes see [Wikipedia](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes). To determine which locales are supported in stringr, see `stringi::stri_locale_list()`.
19+
stringr provides a number of locale-sensitive functions, i.e. functions whose behaviour depends on your locale, of which your language is a very important part. stringr defaults to English, `locale = "en"`, but you can override by providing a different `locale` specified by a lower-case language abbreviation, optionally followed by an underscore (_) and an upper-case region identifier. For example, "en" is English, "en_GB" is British English, and "en_US" is American English. For a list of language codes see [Wikipedia](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) and to see which are supported in stringr, run `stringi::stri_locale_list()`.
2020

2121
There are three main types of function that vary based on locale:
2222

@@ -26,7 +26,7 @@ There are three main types of function that vary based on locale:
2626

2727
## Case conversion
2828

29-
Most languages that use the Latin alphabet (like English) have upper and lower case, but the rules aren't always the same. For example, Turkish has two forms of the letter "I", dotted and dotless.
29+
Most languages that use the Latin alphabet (like English) have upper and lower case, but the rules for converting between the two aren't always the same. For example, Turkish has two forms of the letter "I", dotted and dotless:
3030

3131
```{r}
3232
str_to_upper(c("i", "ı"))
@@ -35,7 +35,7 @@ str_to_upper(c("i", "ı"), locale = "tr")
3535
str_to_lower(c("İ", "I"), locale = "tr")
3636
```
3737

38-
Another example is Dutch, where "ij" is a digraph, a two symbol letter treated as a single letter. `string_to_title()` will incorrectly capitalizes this unless you specify the Dutch locale:
38+
Another example is Dutch, where "ij" is a digraph treated as a single letter. This means that `string_to_title()` will incorrectly capitalize it unless you use a Dutch locale:
3939

4040
```{r}
4141
#| warning: false
@@ -45,9 +45,9 @@ str_to_title(dutch_words)
4545
str_to_title(dutch_words, locale = "nl")
4646
```
4747

48-
(Note that `str_to_title()` handles character-level locale differences but it doesn't implement language-specific rules about which words to capitalize in titles. Fortunately, title case appears to be concept that applies primarily to English.)
48+
(Note that `str_to_title()` handles character-level locale differences but it doesn't implement locale-specific rules about which words not to capitalize. Fortunately, title case appears to be concept that applies primarily to English.)
4949

50-
Case-sensitive string comparison also comes up in `str_equal()`/`str_unique()` and in pattern matching functions. To take advantage of locale-specific case matching, supply `locale` to `str_equal()`/`str_unique()`, and use `coll()` instead of `fixed()` for pattern matching functions.
50+
Case-sensitive string comparison also comes up in `str_equal()`/`str_unique()` and in pattern matching functions. To take advantage of locale-specific case matching, supply `locale` to `str_equal()`/`str_unique()` and use `coll()` instead of `fixed()` in pattern matching functions.
5151

5252
```{r}
5353
turkish_names <- c("İpek", "Işık", "İbrahim")

0 commit comments

Comments
 (0)