mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-08-22 01:58:16 +00:00
Merge pull request #12259 from Profpatsch/put-@-on-right-side-of-rtl-usernames
Comments: Put @ on the right side of right-to-left usernames
This commit is contained in:
commit
42a52b7118
@ -90,19 +90,14 @@ public final class Localization {
|
||||
* Localize a user name like <code>@foobar</code>.
|
||||
*
|
||||
* Will correctly handle right-to-left usernames by using a {@link BidiFormatter}.
|
||||
* For right-to-left usernames, it will put the @ on the right side to read more naturally.
|
||||
*
|
||||
* @param plainName username, with an optional leading <code>@</code>
|
||||
* @return a usernames that can include RTL-characters
|
||||
*/
|
||||
@NonNull
|
||||
public static String localizeUserName(final String plainName) {
|
||||
final BidiFormatter bidi = BidiFormatter.getInstance();
|
||||
|
||||
if (plainName.startsWith("@")) {
|
||||
return "@" + bidi.unicodeWrap(plainName.substring(1));
|
||||
} else {
|
||||
return bidi.unicodeWrap(plainName);
|
||||
}
|
||||
return BidiFormatter.getInstance().unicodeWrap(plainName);
|
||||
}
|
||||
|
||||
public static org.schabi.newpipe.extractor.localization.Localization getPreferredLocalization(
|
||||
|
Loading…
x
Reference in New Issue
Block a user