Skip to content

Commit

Permalink
fix: handle case where there is no history array
Browse files Browse the repository at this point in the history
For #375. Specifically, for
#375 (comment).
  • Loading branch information
liammulh committed Feb 24, 2023
1 parent 1df303d commit fed5465
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,13 @@ const makeTranslationFileContentsForRepo = async ( repo, translation ) => {
explanation: null // this is no longer used, but for some reason we keep it around
};

// Add the history entry to the history array.
const newHistory = oldTranslationFile[ stringKey ].history.concat( [ newHistoryEntry ] );
// Add the history entry to the history array. If the old translation file
// was a manually ported legacy (Java/Flash) sim translation, there might
// not be a history array. This is a rare-but-valid case that we need to
// handle. See https://github.com/phetsims/rosetta/issues/329#issuecomment-1371588737
// and https://github.com/phetsims/rosetta/issues/375#issuecomment-1444581287
// for more info.
const newHistory = ( oldTranslationFile[ stringKey ].history || [] ).concat( [ newHistoryEntry ] );

// Add translated value and history to translation file.
translationFileContentsForRepo[ stringKey ] = {
Expand Down

0 comments on commit fed5465

Please sign in to comment.