### 5.2 How Aspell Selects an Appropriate Dictionary

If the `master` option is set in any fashion (via the command line, the `ASPELL_CONF` environment variable, or a configuration file) Aspell will look for a dictionary of that name. If one could not be found, it will complain.

Otherwise it will use the value of the `lang` option to search for an appropriate dictionary. If more than one dictionary is found for the given language string then it will look for a dictionary with a matching variety if the `variety` option is set. If it is not set it will look for a dictionary without a variety. If after matching the `lang` and `variety` there is still more than one dictionary available it will find one with the size closest to the value of the `size` option. The default size is 60. If Aspell cannot find a dictionary based on the `lang` option then it will give up and complain.

If the `lang` option is not explicitly set its value will be based on the `LC_MESSAGES` locale. This locale is generally taken from the `LC_MESSAGES` environment variable or the `LANG` environment variable if `LC_MESSAGES` is not set. However, if Aspell is being used as a library from within another program which already explicitly set the locale then it will use the locale of the library rather than the environment variables. If Aspell cannot determine the language from the `LC_MESSAGES` locale than it will default to `en_US`.

The list option `dict-alias` can be used to influence which dictionary is selected by creating an alias from one dictionary name to another. This option is most useful when there is more than one dictionary for a given language. For example ‘`add-dict-alias en_US en_US-w_accents`’ will cause Aspell to choose the accented version of the American English dictionary instead of the non-accented version. To add an alias use:

    add-dict-alias NAME VAL