Skip to content

Commit

Permalink
Merge pull request #5437 from qTich/feature/loader-loadable
Browse files Browse the repository at this point in the history
add: `tl` keyword into `renpy.loadable` method
  • Loading branch information
renpytom committed Mar 30, 2024
2 parents 69b8e0a + 93ee54f commit 83d157e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions renpy/exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -2234,7 +2234,7 @@ def get_game_runtime():


@renpy_pure
def loadable(filename, directory=None):
def loadable(filename, directory=None, tl=True):
"""
:doc: file
Expand All @@ -2246,9 +2246,11 @@ def loadable(filename, directory=None):
If not None, a directory to search in if the file is not found
in the game directory. This will be prepended to filename, and
the search tried again.
`tl`
If True, a translation subdirectory will be considered as well.
"""

return renpy.loader.loadable(filename, directory=directory)
return renpy.loader.loadable(filename, tl=tl, directory=directory)


@renpy_pure
Expand Down
4 changes: 2 additions & 2 deletions renpy/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,14 +708,14 @@ def loadable_core(name):
return False


def loadable(name, directory=None):
def loadable(name, tl=True, directory=None):

name = name.lstrip('/')

if (renpy.config.loadable_callback is not None) and renpy.config.loadable_callback(name):
return True

for p in get_prefixes(directory=directory):
for p in get_prefixes(tl=tl, directory=directory):
if loadable_core(p + name):
return True

Expand Down

0 comments on commit 83d157e

Please sign in to comment.