Move locale code out of tm, into _config
State: closed

As discussed last week, one of ugliest runtime imports in `tslibs` is of `tm` for `tm.set_locale`.  This moves `set_locale` and a couple of other locale-related functions out of `tm`.

As discussed in #25162, #25203, #25613, this moves the affected functions to a new directory `pandas/_config`, intended to be strictly "upstream" from the rest of pandas (potentially even made actually-upstream as suggested [here](https://github.com/pandas-dev/pandas/pull/25176#issuecomment-461209852)).

Following this and #25613, a bunch of other cleanup/simplification becomes feasible.

Labels:
name: Clean

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25757?src=pr&el=h1) Report
> Merging [#25757](https://codecov.io/gh/pandas-dev/pandas/pull/25757?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/707c7201a744c48c835f719421e47480beee2184?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `96%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/25757/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/25757?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #25757      +/-   ##
==========================================
+ Coverage   91.25%   91.25%   +<.01%     
==========================================
  Files         172      173       +1     
  Lines       52977    52978       +1     
==========================================
+ Hits        48342    48343       +1     
  Misses       4635     4635
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.82% <96%> (ø)` | :arrow_up: |
| #single | `41.74% <96%> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/25757?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/25757/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `88.83% <100%> (-0.16%)` | :arrow_down: |
| [pandas/\_config/localization.py](https://codecov.io/gh/pandas-dev/pandas/pull/25757/diff?src=pr&el=tree#diff-cGFuZGFzL19jb25maWcvbG9jYWxpemF0aW9uLnB5) | `95.83% <95.83%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25757?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25757?src=pr&el=footer). Last update [707c720...72eced6](https://codecov.io/gh/pandas-dev/pandas/pull/25757?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25757?src=pr&el=h1) Report
> Merging [#25757](https://codecov.io/gh/pandas-dev/pandas/pull/25757?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/8311214023c4613758a5efbd9acb3894147aa704?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `96%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/25757/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/25757?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #25757      +/-   ##
==========================================
+ Coverage   91.26%   91.26%   +<.01%     
==========================================
  Files         172      173       +1     
  Lines       52964    52965       +1     
==========================================
+ Hits        48337    48338       +1     
  Misses       4627     4627
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.83% <96%> (ø)` | :arrow_up: |
| #single | `41.74% <96%> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/25757?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/25757/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `89.3% <100%> (-0.15%)` | :arrow_down: |
| [pandas/\_config/localization.py](https://codecov.io/gh/pandas-dev/pandas/pull/25757/diff?src=pr&el=tree#diff-cGFuZGFzL19jb25maWcvbG9jYWxpemF0aW9uLnB5) | `95.83% <95.83%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25757?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25757?src=pr&el=footer). Last update [8311214...a0c6fa2](https://codecov.io/gh/pandas-dev/pandas/pull/25757?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

conceptually this looks good. some failing checks.
> what is the issue with get_locales moving as well?

`get_locales` depends on `pd.options.display.encoding`, so it can't be moved (in a way that keeps the dependency structure clean) until pd.core.config and parts of config_init are moved to _config.
CI checks fixed.
@jreback rebased following #25613.  Nice follow-up available after this.
thanks @jbrockmendel