@@ -47,7 +47,6 @@ def fetch():
47
47
call (f'msgcat --no-location -o { file } { file } ' , shell = True )
48
48
49
49
50
- RESOURCE_NAME_MAP = {'glossary_' : 'glossary' }
51
50
PROJECT_SLUG = 'python-newest'
52
51
53
52
@@ -60,14 +59,7 @@ def recreate_tx_config():
60
59
config .write ('[main]\n host = https://www.transifex.com\n ' )
61
60
for resource in resources :
62
61
slug = resource .slug
63
- name = RESOURCE_NAME_MAP .get (slug , slug )
64
- if '--' in slug :
65
- directory , file_name = name .split ('--' )
66
- if match (r'\d+_\d+' , file_name ): # whatsnew
67
- file_name = file_name .replace ('_' , '.' )
68
- file_filter = f'{ directory } /{ file_name } .po'
69
- else :
70
- file_filter = f'{ name } .po'
62
+ file_filter = _denormalize_resource_name (slug )
71
63
72
64
config .write (
73
65
dedent (
@@ -81,6 +73,22 @@ def recreate_tx_config():
81
73
)
82
74
83
75
76
+ def _denormalize_resource_name (slug ):
77
+ """
78
+ Reversion of transifex.normalize_resource_name in sphinx-intl
79
+ https://github.com/sphinx-doc/sphinx-intl/blob/c327016e394903966ab966fe49f58bcaa70588af/sphinx_intl/transifex.py#L45-L56
80
+ """
81
+ name = {'glossary_' : 'glossary' }.get (slug , slug )
82
+ if '--' in slug :
83
+ directory , file_name = name .split ('--' )
84
+ if match (r'\d+_\d+' , file_name ): # whatsnew
85
+ file_name = file_name .replace ('_' , '.' )
86
+ file_filter = f'{ directory } /{ file_name } .po'
87
+ else :
88
+ file_filter = f'{ name } .po'
89
+ return file_filter
90
+
91
+
84
92
@dataclass
85
93
class ResourceLanguageStatistics :
86
94
name : str
0 commit comments