U
    d                     @   s0   d dl Z d dlZd dlmZ G dd deZdS )    N)ElementTreec                   @   s   e Zd Zdd Zdd ZdS )CountryInformationc           
      C   s   i | _ d}tj|rt|d}|d}|D ]V}d|jkrH|jd }n
|jd }d|jkrh|jd }n
|jd }td|| j |< q.d | _	d | _
tjd	d
d}|d}|d}	|	dkrt|}	||d |	 | _
| | j
| _	d S )Nz%/usr/share/xml/iso-codes/iso_3166.xml)fileZiso_3166_entryZcommon_namenameZalpha_2_codeZalpha_3_codeZiso_3166ZLANGzen.UK)default_.   )	countriesospathexistsr   ZgetiteratorZattribgettextdgettextZcountrycodegetenvfindlenget_country_name)
selffnameZetitZelmZdescrr   Zlocaleaz r   G/usr/lib/python3/dist-packages/softwareproperties/CountryInformation.py__init__   s,    







zCountryInformation.__init__c                 C   s    || j kr| j | }|S |S d S )N)r   )r   r   r   r   r   r   r   7   s    

z#CountryInformation.get_country_nameN)__name__
__module____qualname__r   r   r   r   r   r   r      s   r   )r   r   Zxml.etree.ElementTreer   objectr   r   r   r   r   <module>   s   