Skip to content

Support dynamic tempDir parameter in TranslationExtension#151

Merged
f3l1x merged 5 commits into
masterfrom
claude/blissful-clarke-Mwr80
May 27, 2026
Merged

Support dynamic tempDir parameter in TranslationExtension#151
f3l1x merged 5 commits into
masterfrom
claude/blissful-clarke-Mwr80

Conversation

@ohmyfelix

Copy link
Copy Markdown
Contributor

Summary

Updated TranslationExtension to support dynamic tempDir parameters that are resolved at container build time, rather than requiring a static string value.

Key Changes

  • Modified the cache.dir configuration schema to accept both string and Statement types, allowing for dynamic parameter resolution
  • Changed tempDir parameter retrieval to use null coalescing (?? null) instead of throwing an exception when the parameter is not set
  • Implemented conditional logic to handle both static string tempDir values and dynamic Statement instances:
    • For static strings: concatenates the path directly
    • For dynamic parameters: uses a Statement with implode to concatenate at runtime
  • Added test case test13() to verify the extension works correctly when tempDir is configured as a dynamic parameter

Implementation Details

The change allows the translation cache directory to be properly configured even when tempDir is a dynamic parameter (e.g., when using setDynamicParameterNames() in the compiler). This is achieved by deferring the path concatenation to runtime via a Statement object when the parameter cannot be resolved statically.

https://claude.ai/code/session_015WctUVqnDnBvxgpn8o6ZuB

claude added 5 commits May 27, 2026 20:31
Restore support for using `tempDir` as a dynamic container parameter.
The strict is_string() check rejected DynamicParameter values; instead
build the default cache dir as a dynamic concatenation when tempDir is
not a plain string.

https://claude.ai/code/session_015WctUVqnDnBvxgpn8o6ZuB
Rename the tempDir test cases to intent-revealing methods and build the
containers with Contributte\Tester\Utils\ContainerBuilder (buildWith for
the dynamic-parameter scenario).

https://claude.ai/code/session_015WctUVqnDnBvxgpn8o6ZuB
contributte/tester requires PHP >=8.2; build the test containers with
Nette\DI\ContainerLoader directly instead.

https://claude.ai/code/session_015WctUVqnDnBvxgpn8o6ZuB
@f3l1x f3l1x merged commit 913524c into master May 27, 2026
12 checks passed
@f3l1x f3l1x deleted the claude/blissful-clarke-Mwr80 branch May 27, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants