def read_localization_ftl()

in fluent/migrate/_context.py [0:0]


    def read_localization_ftl(self, path: str):
        """Read and parse an existing localization FTL file.

        Create a new FTL.Resource if the file doesn't exist or can't be
        decoded.
        """
        fullpath = os.path.join(self.localization_dir, path)
        try:
            return self.read_ftl_resource(fullpath)
        except OSError:
            logger = logging.getLogger("migrate")
            logger.info(
                "Localization file {} does not exist and "
                "it will be created".format(path)
            )
            return FTL.Resource()
        except UnicodeDecodeError:
            logger = logging.getLogger("migrate")
            logger.warning(
                "Localization file {} has broken encoding. "
                "It will be re-created and some translations "
                "may be lost".format(path)
            )
            return FTL.Resource()