Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #14173: Use new SnipeTranslator to handle pluralized localizations #14175

Merged
merged 1 commit into from
Jan 26, 2024

Conversation

uberbrady
Copy link
Collaborator

@uberbrady uberbrady commented Jan 26, 2024

Our locale directories are named things like 'en-US'. But the pluralization code used by Laravel (through Symfony) requires locale names to be in the format en_US. This change introduces a new Translator, SnipeTranslator, which is a tiny set of changes against the built-in one. It additionally adds a SnipeTranslationServiceProvider, which loads up the new Translator.

Fixes #14173

…ored

Our locale directories are named things like 'en-US'. But the pluralization
code used by Laravel (through Symfony) requires locale names to be
in the format en_US. This change introduces a new Translator,
SnipeTranslator, which is a tiny set of changes against the built-in
one. It additionally adds a SnipeTranslationServiceProvider, which
loads up the new Translator.
Copy link

what-the-diff bot commented Jan 26, 2024

PR Summary

  • Introduction of SnipeTranslationServiceProvider
    A new file under app/Providers/SnipeTranslationServiceProvider.php has been added. This file enhances the Translation Service Provider, allowing it to use a new class called SnipeTranslator.

  • Creation of SnipeTranslator Service
    Another new file app/Services/SnipeTranslator.php is also included in this PR. It modifies the 'choice' method to alter the language locale format from 'en-US' to 'en_US', streamlining language localization within the application.

  • Configuration Modification
    There are modifications to the config/app.php file. The primary change is the replacement of the pre-existing TranslationServiceProvider with the just-introduced SnipeTranslationServiceProvider. This change should help us handle language localization more efficiency in the system.

@snipe snipe merged commit c0241a8 into snipe:develop Jan 26, 2024
8 checks passed
@snipe
Copy link
Owner

snipe commented Jan 26, 2024

Really nice work here - thanks so much! And thanks for the time and the rubber-ducking. This one was a tough one, and I think this solution is the least awful of the eleventy-billion we discussed.

GyRy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants