Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8976221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:04:53+00:00 2026-06-15T19:04:53+00:00

pspell Is there a way to get an array of dictionaries that pspell supports,

  • 0

pspell

Is there a way to get an array of dictionaries that pspell supports, preferably with their full human-readble names, using the PHP API?

For the time being I’m doing it this way:

$dicts = explode(PHP_EOL,rtrim(`aspell dicts`));

But that still doesn’t give me the human-friendly version, (e.g., en_CA might be "English – Canadian")


Solution

Here’s what I came up with:

$dicts = explode(PHP_EOL,rtrim(`aspell dicts`));
$ltr = array();
foreach($dicts as $dict) {
    if(preg_match('`^([a-z]+)$`',$dict,$m)) {
        $lang = _iso639_1_to_lang_name($dict) ?: $dict;
    } elseif(preg_match('`^([a-z]+)_([A-Z]+)$`',$dict,$m)) {
        $lang = (_iso639_1_to_lang_name($m[1]) ?: $m[1]).' - '.(_country_code_to_adjectival($m[2])?:$m[2]);
    } elseif(preg_match('`^([a-z]+)_([A-Z]+)-(.*)$`',$dict,$m)) {
        $lang = (_iso639_1_to_lang_name($m[1]) ?: $m[1]).' - '.(_country_code_to_adjectival($m[2])?:$m[2]).' - '.ucwords(str_replace('_',' ',$m[3]));
    } elseif(preg_match('`^([a-z]+)-(.*)$`',$dict,$m)) {
        $lang = (_iso639_1_to_lang_name($m[1]) ?: $m[1]).' - '.ucwords(str_replace('_',' ',$m[2]));
    } else {
        $lang = $dict;
    }
    $ltr[$dict] = $lang;
}

Those functions just look up the full names from ISO codes based on data I scraped from Wikipedia.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T19:04:54+00:00Added an answer on June 15, 2026 at 7:04 pm

    Do you mean find out which dictionaries you have on your system? pspell is just a very thin wrapper over the GNU aspell library. It supports whatever the aspell library supports, but unfortunately it does not provide a way to list all the dictionaries. It would be nice if that functionality was added.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to use PHP's PSpell check function in my program. Is there an
I am using pspell like this: $ps = pspell_new(en); if(!pspell_check($ps, $word)) { $suggestion =
I am using pspell to spell check some words. However if the word is
I have this script: <?php ob_start(); $get = $_GET['q']; $pspell = pspell_new('en','canadian','','utf-8',PSPELL_FAST); function spellCheckWord($word)
I've noticed that the PHP make that I'm using on a dev box doesn't
is it possible to create something like a global dictionary for pspell? I tried
I'm using DOMPDF to generate PDFs inside of a symfony application. On my current
I am trying to install pspell for PHP 5 in Ubuntu. I have installed
I am trying to use the pspell function in my php application I am
I am having issues with pspell when searching for numeric values I end up

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.