code: private JsonObject patch(String fileName, String code, JsonObject root) {
      for (Map.Entry<String, JsonObject> entry : patches.entrySet()) {
        JsonObject patch = entry.getValue();
        if (!patch.get("filename").getAsString().equals(fileName)) {
          continue;
        }
        
        // Check if this patch should be applied to the locale we're processing/
        JsonArray locales = patch.getAsJsonArray("locales");
        boolean shouldPatch = false;
        if (code == null) {
          shouldPatch = true;
        } else {
          // Only patch if the locale matches.
          for (JsonElement locale : locales) {
            if (locale.getAsString().equals(code)) {
              shouldPatch = true;
              break;
            }
          }
        }
        
        if (!shouldPatch) {
          return root;
        }
    
        JsonObject src = resolve(patch, "patch");
        JsonObject dst = root;
        if (patch.get("type").getAsString().equals("main")) {
          dst = resolve(root, "main", code);
        }
        
        System.out.printf("Applying patch %s to %s\n", entry.getKey(), code);
        patchObject(src, dst);
      }
      
      return root;
    }
docs: Apply a patch to the given filename, if applicable.