diff --git a/i18n/extract.py b/i18n/extract.py index 209ee3413d..1e9acdc110 100755 --- a/i18n/extract.py +++ b/i18n/extract.py @@ -41,9 +41,6 @@ def main(): create_dir_if_necessary(LOCALE_DIR) source_msgs_dir = CONFIGURATION.source_messages_dir - generated_files = ['django-partial.po', 'djangojs.po', 'mako.po'] - - # Prepare makemessages command. makemessages = "django-admin.py makemessages -l en" ignores = " ".join('--ignore="{}/*"'.format(d) for d in CONFIGURATION.ignore_dirs) if ignores: @@ -70,10 +67,9 @@ def main(): # Segment the generated files. segmented_files = segment_pofiles("en") - generated_files.extend(segmented_files) # Finish each file. - for filename in generated_files: + for filename in segmented_files: LOG.info('Cleaning %s' % filename) po = pofile(source_msgs_dir.joinpath(filename)) # replace default headers with edX headers diff --git a/i18n/make_dummy.py b/i18n/make_dummy.py index 58a874f5fb..13ccef5ef3 100755 --- a/i18n/make_dummy.py +++ b/i18n/make_dummy.py @@ -42,11 +42,9 @@ def main(file, locale): for msg in pofile: converter.convert_msg(msg) - # If any message has a plural, then the file needs plural information. # Apply declaration for English pluralization rules so that ngettext will # do something reasonable. - if any(m.msgid_plural for m in pofile): - pofile.metadata['Plural-Forms'] = 'nplurals=2; plural=(n != 1);' + pofile.metadata['Plural-Forms'] = 'nplurals=2; plural=(n != 1);' new_file = new_filename(file, locale) create_dir_if_necessary(new_file) diff --git a/i18n/segment.py b/i18n/segment.py index 8420694eae..7920f896c4 100755 --- a/i18n/segment.py +++ b/i18n/segment.py @@ -93,13 +93,13 @@ def segment_pofile(filename, segments): else: msg_segments.add(filename) + assert msg_segments if len(msg_segments) == 1: # This message belongs in this segment. segment_file = msg_segments.pop() segment_po_files[segment_file].append(msg) else: - # Either it's in more than one segment, or none, so put it back in - # the main file. + # It's in more than one segment, so put it back in the main file. remaining_po.append(msg) # Write out the results. @@ -113,9 +113,6 @@ def segment_pofile(filename, segments): pofile.save(out_file) files_written.add(out_file) - LOG.info(writing_msg.format(file=filename, num=len(remaining_po))) - remaining_po.save(filename) - return files_written