@@ -4,6 +4,7 @@ import { hsv } from 'd3-hsv';
44import { get , writable } from 'svelte/store' ;
55import { jsonify , tokenize } from '../../../shared/parseSave' ;
66import { ADDITIONAL_COLORS } from './colors' ;
7+ import { appSettings } from './settings' ;
78import stellarMapsApi from './stellarMapsApi' ;
89import { timeItAsync } from './utils' ;
910
@@ -14,6 +15,14 @@ export const stellarisDataPromiseStore = writable(
1415 } ) ,
1516) ;
1617
18+ // reload data if appStellarisLanguage setting changed
19+ let loadedStellarisLanguage = get ( appSettings ) . appStellarisLanguage ;
20+ appSettings . subscribe ( ( value ) => {
21+ if ( value . appStellarisLanguage !== loadedStellarisLanguage ) {
22+ loadStellarisData ( ) ;
23+ }
24+ } ) ;
25+
1726export function loadStellarisData ( ) {
1827 const stellarisDataPromise = loadStellarisDataUnwrapped ( ) ;
1928 stellarisDataPromiseStore . set ( stellarisDataPromise ) ;
@@ -23,12 +32,14 @@ export function loadStellarisData() {
2332async function loadStellarisDataUnwrapped ( ) {
2433 const path = get ( stellarisPathStore ) || ( await stellarMapsApi . loadStellarisInstallDir ( ) ) ;
2534 stellarisPathStore . set ( path ) ;
26- const [ colors , loc ] = await Promise . all ( [ loadColors ( path ) , loadLoc ( path ) ] ) ;
35+ const language = get ( appSettings ) . appStellarisLanguage ;
36+ loadedStellarisLanguage = language ;
37+ const [ colors , loc ] = await Promise . all ( [ loadColors ( path ) , loadLoc ( path , language ) ] ) ;
2738 return { colors, loc } ;
2839}
2940
30- function loadLoc ( path : string ) {
31- return timeItAsync ( 'loadLoc' , stellarMapsApi . loadLoc , path ) ;
41+ function loadLoc ( path : string , language : string ) {
42+ return timeItAsync ( 'loadLoc' , stellarMapsApi . loadLoc , path , language ) ;
3243}
3344
3445async function loadColors ( path : string ) : Promise < Record < string , string > > {
0 commit comments