Skip to content

fix(sample_source_call): respect local argument (#9)#13

Open
VincentGuyader wants to merge 3 commits into
masterfrom
fix/locale-source-call-9
Open

fix(sample_source_call): respect local argument (#9)#13
VincentGuyader wants to merge 3 commits into
masterfrom
fix/locale-source-call-9

Conversation

@VincentGuyader

Copy link
Copy Markdown
Member

Summary

  • sample_source_call() was always returning the French-locale list (Local, France, Europe, International) regardless of the local = argument, leaking France into datasets generated with local = "en_US". Branched on the locale so en_US now yields Local, US, Europe, International.
  • local = is now declared with match.arg(), matching the rest of the file's contract: any unsupported locale (e.g. "de_DE") errors out instead of silently falling through to en_US.

Test plan

  • tests/testthat/test-locale.R: 6 PASS, including an explicit assertion that France does not appear in the en_US factor levels and a regression on the unknown-locale rejection.

Closes #9

sample_source_call() was always returning the French-locale list
('Local','France','Europe','International'), leaking 'France' as a
source when users passed local='en_US'. Switch the list on the locale
the same way the other sample_* helpers do, so en_US now yields
'Local','US','Europe','International'.
Aligns sample_source_call() with the rest of the file's locale handling
and turns silent fallthrough on unknown locales (e.g. local = 'de_DE')
into an explicit error instead of yielding the en_US list.
@VincentGuyader VincentGuyader self-assigned this Apr 26, 2026
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.

Locale don't work

1 participant