11import  sys 
2- from  typing  import  NamedTuple 
2+ from  typing  import  List ,  NamedTuple 
33
44from  pydantic .version  import  VERSION  as  PYDANTIC_VERSION 
55from  PyQt5 .Qt  import  PYQT_VERSION_STR 
@@ -26,6 +26,12 @@ class Attribution(NamedTuple):
2626    url : str 
2727
2828
29+ class  AttributionTranslation (NamedTuple ):
30+     language : str 
31+     author : str 
32+     author_url : str 
33+ 
34+ 
2935class  AboutDialog (QDialog , Ui_AboutDialog ):
3036    def  __init__ (self , parent ):
3137        super ().__init__ (parent )
@@ -131,18 +137,28 @@ def __init__(self, parent):
131137            ),
132138        ]
133139
140+         attributions_translation  =  [
141+             AttributionTranslation (
142+                 "Hungarian" ,
143+                 "samu112" ,
144+                 "https://crowdin.com/profile/samu112" ,
145+             ),
146+         ]
147+ 
134148        attributions_txt  =  [
135149            "<style>p, h3 {text-align: center;}</style>" ,
136150            self .generate_attributions (attributions_general ),
137151            "<h3>{0}</h3>" .format (self .tr ("Python packages" )),
138152            self .generate_attributions (attributions_python ),
139153            "<h3>{0}</h3>" .format (self .tr ("Graphics" )),
140154            self .generate_attributions (attributions_gui ),
155+             "<h3>{0}</h3>" .format (self .tr ("Translations" )),
156+             self .generate_attributions_translations (attributions_translation ),
141157        ]
142158
143159        self .attributionsBox .setText ("\n " .join (attributions_txt ))
144160
145-     def  generate_attributions (self , attributions ):
161+     def  generate_attributions (self , attributions :  List [ Attribution ] ):
146162        attributions_txt  =  []
147163        for  a  in  attributions :
148164            app_title  =  "{0} {1}" .format (a .title , a .version  or  "" ).strip ()
@@ -160,3 +176,19 @@ def generate_attributions(self, attributions):
160176            attributions_txt .append (attribution_txt )
161177
162178        return  "\n " .join (attributions_txt )
179+ 
180+     def  generate_attributions_translations (
181+         self , attributions : List [AttributionTranslation ]
182+     ):
183+         attributions_txt  =  []
184+         for  a  in  attributions :
185+             author_url  =  f'<a href="{ a .author_url }  ">{ a .author }  </a>' 
186+ 
187+             attribution_txt  =  self .tr ("<p><b>{LANGUAGE}</b> by {AUTHOR_URL}</p>" )
188+ 
189+             attribution_txt  =  attribution_txt .replace ("{LANGUAGE}" , a .language )
190+             attribution_txt  =  attribution_txt .replace ("{AUTHOR_URL}" , author_url )
191+ 
192+             attributions_txt .append (attribution_txt )
193+ 
194+         return  "\n " .join (attributions_txt )
0 commit comments