code: public static InputStream readCustomLayout(Class<? extends Component> layoutClass, String relativeName) {
  
          CmsMacroResolver resolver = new CmsMacroResolver() {
  
              @Override
              public String getMacroValue(String macro) {
  
                  return CmsEncoder.escapeXml(super.getMacroValue(macro));
              }
          };
          resolver.setMessages(CmsVaadinUtils.getWpMessagesForCurrentLocale());
          InputStream layoutStream = CmsVaadinUtils.filterUtf8ResourceStream(
              layoutClass.getResourceAsStream(relativeName),
              resolver.toFunction());
          return layoutStream;
      }
docs: Reads a layout from a resource, applies basic i18n macro substitution on the contained text, and returns a stream of the transformed
  data.<p>
  
  @param layoutClass the class relative to which the layout resource will be looked up
  @param relativeName the file name of the layout file
  
  @return an input stream which produces the transformed layout resource html