-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add UI for switching public mail notification language #31869
Conversation
692ca98
to
0a7f9c4
Compare
Codecov Report
@@ Coverage Diff @@
## master #31869 +/- ##
============================================
+ Coverage 63.53% 63.58% +0.05%
+ Complexity 18555 18553 -2
============================================
Files 1167 1169 +2
Lines 69566 69604 +38
Branches 1264 1264
============================================
+ Hits 44201 44260 +59
+ Misses 24996 24975 -21
Partials 369 369
Continue to review full report at Codecov.
|
d3419bc
to
a6b515d
Compare
as discussed, ready for review again |
lib/private/Helper/LocaleHelper.php
Outdated
// TRANSLATORS this is a self-name of your language for the language switcher | ||
$endonym = (string)$l->t('__language_name__'); | ||
//Check if the language name is in the translation file | ||
// Fallback to hardcoded language name if translation is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if translation is ???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'if it is not'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far.
I'm missing unit tests for the helper. This is important due to the complexity of the code you have simplified.
$l = $this->lfactory->get('settings', $lang); | ||
// TRANSLATORS this is the language name for the language switcher in the personal settings and should be the localized version | ||
$potentialName = (string) $l->t('__language_name__'); | ||
if ($l->getLanguageCode() === $lang && \substr($potentialName, 0, 1) !== '_') {//first check if the language name is in the translation file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like this complex logic got simplified in getNormalizedLanguages
?
please make sure you cover all these old code paths in a unit test in LocaleHelperTest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PVince81 I just made it more readable by moving L79-83 into the getLanguageNameByCode
method. The logic itself was not that complex, but it needed cutting into smaller pieces and renaming some variables for the sake of better readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
basically we check if the current lang has a self-name in it's translation file, then fallback to harcoded language self-names and when everything else fails use language code as a self-name.
Codecov didn't complain about missing tests for LocaleHelper because the code in question seems to be touched by the other tests. Would still be good to have a test class there to enforce (and document) the many different locale formats |
It would be nice to have acceptance tests for the UI settings page. I made a general issue for that, and when @paurakhsharma gets initial tests, then it will be easy to add tests for this UI element. |
@PVince81 added some tests with explanations |
* @var string[] | ||
*/ | ||
private $languageCodes = [ | ||
'el' => 'Ελληνικά', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we can get these from a PHP library in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 looks good, thanks
@VicDeo please backport |
I guess that this is documentation relevant at least because of: |
Stable10: #32004 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
Sharing
sectionRelated Issue
https://github.com/owncloud/enterprise/issues/2435#issuecomment-396551153
Motivation and Context
Allows admin users change a language used for public mail notifications
How Has This Been Tested?
Language selector in Settings->Personal -> General -> Language should NOT change it's behavior
A new option should be visible only when
Allow users to send mail notification for shared files
is checked in Settings->Admin->SharingSwitching the dropdown to the value
Owner language
should reset to the current behavior when the notification is sent in the language of the file ownerexpected:
php occ config:app:get core shareapi_public_notification_lang
produces an empty output in this case (no value set)Switching the dropdown to any other value except
Owner language
should updateshareapi_public_notification_lang
with a respective language codeScreenshots (if appropriate):
Types of changes
Checklist: