@@ -71,7 +71,6 @@ use cosmic::{
71
71
use cosmic_app_list_config:: AppListConfig ;
72
72
use freedesktop_desktop_entry:: PathSource ;
73
73
use itertools:: Itertools ;
74
- use langtag:: { LangTag , LangTagBuf } ;
75
74
use log:: error;
76
75
use once_cell:: sync:: Lazy ;
77
76
use serde:: { Deserialize , Serialize } ;
@@ -214,7 +213,7 @@ struct CosmicAppLibrary {
214
213
config : AppLibraryConfig ,
215
214
cur_group : usize ,
216
215
active_surface : bool ,
217
- locale : Option < LangTagBuf > ,
216
+ locale : Option < String > ,
218
217
edit_name : Option < String > ,
219
218
new_group : Option < String > ,
220
219
dnd_icon : Option < usize > ,
@@ -349,18 +348,8 @@ pub fn menu_control_padding() -> Padding {
349
348
impl CosmicAppLibrary {
350
349
pub fn load_apps ( & mut self ) {
351
350
let xdg_current_desktop = std:: env:: var ( "XDG_CURRENT_DESKTOP" ) . ok ( ) ;
352
- let locale = self . locale . as_ref ( ) . and_then ( |l| {
353
- let Some ( primary) = l. language ( ) . map ( |l| l. primary ( ) ) else {
354
- return None ;
355
- } ;
356
- Some ( if let Some ( region) = l. region ( ) {
357
- format ! ( "{}_{}" , primary. as_str( ) , region. as_str( ) )
358
- } else {
359
- primary. as_str ( ) . into ( )
360
- } )
361
- } ) ;
362
351
self . all_entries =
363
- cosmic:: desktop:: load_applications_filtered ( locale. as_deref ( ) , |entry| {
352
+ cosmic:: desktop:: load_applications_filtered ( self . locale . as_deref ( ) , |entry| {
364
353
entry. exec ( ) . is_some ( )
365
354
&& !entry. no_display ( )
366
355
&& xdg_current_desktop
@@ -1451,10 +1440,9 @@ impl cosmic::Application for CosmicAppLibrary {
1451
1440
config. groups . sort ( ) ;
1452
1441
1453
1442
let self_ = Self {
1454
- // TODO proper conversion is
1455
- locale : current_locale:: current_locale ( )
1443
+ locale : std:: env:: var ( "LANG" )
1456
1444
. ok ( )
1457
- . and_then ( |l| LangTagBuf :: new ( l ) . ok ( ) ) ,
1445
+ . and_then ( |l| l . split ( "." ) . next ( ) . map ( str :: to_string ) ) ,
1458
1446
config,
1459
1447
core,
1460
1448
helper,
0 commit comments