@@ -23,6 +23,7 @@ def getParser(path):
23
23
from .cldr import get_plural_categories
24
24
from .transforms import Source
25
25
from .merge import merge_resource
26
+ from .util import get_message
26
27
from .errors import (
27
28
EmptyLocalizationError , NotSupportedError , UnreadableReferenceError )
28
29
@@ -205,11 +206,20 @@ def get_sources(acc, cur):
205
206
self .reference_resources [target ] = reference_ast
206
207
207
208
for node in transforms :
209
+ ident = node .id .name
208
210
# Scan `node` for `Source` nodes and collect the information they
209
211
# store into a set of dependencies.
210
212
dependencies = fold (get_sources , node , set ())
211
213
# Set these sources as dependencies for the current transform.
212
- self .dependencies [(target , node .id .name )] = dependencies
214
+ self .dependencies [(target , ident )] = dependencies
215
+
216
+ # The target Fluent message should exist in the reference file. If
217
+ # it doesn't, it's probably a typo.
218
+ if get_message (reference_ast .body , ident ) is None :
219
+ logger = logging .getLogger ('migrate' )
220
+ logger .warn (
221
+ 'Message "{}" was not found in {}' .format (
222
+ ident , reference ))
213
223
214
224
# Keep track of localization resource paths which were defined as
215
225
# sources in the transforms.
0 commit comments