Angus Leeming <[EMAIL PROTECTED]> writes:

| My recent splurge of patches (for which apologies again for notposting to the 
| list first) have done nothing more than internationalise the language names 
| in the Character, Document and Preferences dialogs. They all do it the same 
| way, so I had to split some functions off into their own files that's all.
>
| Anyway, whilst all three dilaogs now have a combox of internationalised 
| language names, the vector of names really should be sorted. These comboxes 
| are all built from the info passed from the function below. The first item in 
| the pair is the internationalised language name, the second is it's 
| identifier used by lyx.
>
| Could someone devise an approximate and appropriate sorting functor
| please? I 
| realise that the exact one is pretty complex but we need something
| at least...

struct our_sort_func {
int operator()(LanguagePair const & lp1, LanguagePair const & lp2) const
        {
                return lp1.first < lp2.first;
        }
};

sort(langs.begin(), langs.end(), our_sort_func());


>
| Angus
>
| src/frontends/controllers/front_lang.C:
| namespace frnt {
>
| vector<LanguagePair> const getLanguageData()
| {
|       vector<LanguagePair> langs(languages.size() + 2);
>
|       langs[0].first = N_("No change"); langs[0].second = "No change";
|       langs[1].first = N_("Reset");     langs[1].second = "Reset";
>
|       vector<string>::size_type i = 2;
|       for (Languages::const_iterator cit = languages.begin();
|            cit != languages.end(); ++cit) {
|               langs[i].first  = cit->second.display();
|               langs[i].second = cit->second.lang();
|               ++i;
|       }
>
|       return langs;
| }
>
| } // namespace frnt
>

-- 
        Lgb

Reply via email to