@@ -294,27 +294,45 @@ private async Task LocalizeDependencyObjects()
294294
295295 private void LocalizeDependencyObject ( DependencyObject dependencyObject )
296296 {
297- if ( Uids . GetUid ( dependencyObject ) is string uid &&
298- CurrentDictionary . TryGetItems ( uid , out LanguageDictionary . Items ? items ) is true )
297+ if ( Uids . GetUid ( dependencyObject ) is not string uidSource ||
298+ string . IsNullOrEmpty ( uidSource ) is true )
299299 {
300- foreach ( LanguageDictionary . Item item in items )
301- {
302- LocalizeDependencyObject ( dependencyObject , item ) ;
303- }
300+ Logger . LogWarning ( "DependencyObject does not have Uid. [Type: {Type}]" , dependencyObject . GetType ( ) ) ;
301+ return ;
302+ }
303+
304+ string uid = uidSource ;
305+ string ? uidDependencyPropertyName = null ;
306+
307+ if ( uidSource . Split ( '.' ) is { Length : 2 } splitResult )
308+ {
309+ uid = splitResult [ 0 ] ;
310+ uidDependencyPropertyName = splitResult [ 1 ] + "Property" ;
311+ }
312+
313+ if ( CurrentDictionary . TryGetItems ( uid , out LanguageDictionary . Items ? items ) is false )
314+ {
315+ Logger . LogWarning ( "DependencyObject does not have Uid in the dictionary. [Type: {Type} Uid: {Uid}]" , dependencyObject . GetType ( ) , uid ) ;
316+ return ;
317+ }
318+
319+ foreach ( LanguageDictionary . Item item in items )
320+ {
321+ LocalizeDependencyObject ( dependencyObject , uidDependencyPropertyName ?? item . DependencyPropertyName , item . Value ) ;
304322 }
305323 }
306324
307- private void LocalizeDependencyObject ( DependencyObject dependencyObject , LanguageDictionary . Item item )
325+ private void LocalizeDependencyObject ( DependencyObject dependencyObject , string dependencyPropertyName , string value )
308326 {
309327 if ( GetDependencyProperty (
310328 dependencyObject ,
311- item . DependencyPropertyName ) is DependencyProperty dependencyProperty )
329+ dependencyPropertyName ) is DependencyProperty dependencyProperty )
312330 {
313- LocalizeDependencyObjectsWithDependencyProperty ( dependencyObject , dependencyProperty , item . Value ) ;
331+ LocalizeDependencyObjectsWithDependencyProperty ( dependencyObject , dependencyProperty , value ) ;
314332 return ;
315333 }
316334
317- LocalizeDependencyObjectsWithoutDependencyProperty ( dependencyObject , item . Value ) ;
335+ LocalizeDependencyObjectsWithoutDependencyProperty ( dependencyObject , value ) ;
318336 }
319337
320338 private void LocalizeDependencyObjectsWithDependencyProperty ( DependencyObject dependencyObject , DependencyProperty dependencyProperty , string value )
0 commit comments