Skip to content

Add locales mapping for gettext#76

Open
darkdef wants to merge 33 commits into
yiisoft:masterfrom
darkdef:gettext-mapping
Open

Add locales mapping for gettext#76
darkdef wants to merge 33 commits into
yiisoft:masterfrom
darkdef:gettext-mapping

Conversation

@darkdef

@darkdef darkdef commented Apr 20, 2025

Copy link
Copy Markdown
Contributor
Q A
Is bugfix?
New feature? ✔️
Breaks BC?
Fixed issues #73

@codecov

codecov Bot commented Apr 20, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (9d228cf) to head (0a5e1d2).

Additional details and impacted files
@@             Coverage Diff             @@
##              master       #76   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity         9        10    +1     
===========================================
  Files              1         1           
  Lines             18        21    +3     
===========================================
+ Hits              18        21    +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@samdark

samdark commented Apr 21, 2025

Copy link
Copy Markdown
Member

Looks 👍 Would you please update docs?

Comment thread src/MessageSource.php
public function __construct(
private string $path
private string $path,
private array|Closure|null $localesMap = null

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add psalm annotation for closure

Comment thread src/MessageSource.php
private function setLocale(string $locale): void
{
if ($this->localesMap instanceof Closure) {
$locale = (string) ($this->localesMap)($locale);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allow to return null in closure and use $locale as is in this case.

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