This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.menu-item { | |
/* Margin at end of text, depending on layout | |
direction and writing direction */ | |
margin-inline-end: 1rem; | |
} | |
.menu-item:first-child { | |
margin-inline-end: 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.menu-item { | |
margin-right: 1rem; | |
} | |
.menu-item:first-child { | |
margin-right: 0; | |
} | |
[dir="rtl"] .menu-item { | |
margin-right: 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.sidebar p { | |
/* default styles */ | |
} | |
.sidebar p:lang(fr) { | |
/* French overrides */ | |
} | |
/* or */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.sidebar p { | |
// default styles | |
} | |
[dir="rtl"] .sidebar p { | |
// right-to-left overrides | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html lang="en" dir="ltr"> | |
<!-- or --> | |
<html lang="ar" dir="rtl"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import store from "../redux/store"; | |
export default function getCurrentLocale() { | |
const state = store.getState(); | |
return state.i18n.locale; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from babel.numbers import format_decimal | |
value = 123456.78 | |
print(format_decimal(value, locale='en_US')) # => 123,456.78 (American format) | |
print(format_decimal(value, locale='fr_FR')) # => 123 456,78 (French format) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Locale; | |
import java.text.NumberFormat; | |
public class FormatNumbers { | |
public static void main(String []args) { | |
double number = 123456.78; | |
NumberFormat usFormatter = NumberFormat.getInstance(new Locale("en", "US")); | |
System.out.println(usFormatter.format(number)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$number = 123456.78; | |
$americanFormatter = new NumberFormatter('en-US', NumberFormatter::DECIMAL); | |
echo $americanFormatter->format($number); // => 123,456.78 (American format) | |
$frenchFormatter = new NumberFormatter('fr-FR', NumberFormatter::DECIMAL); | |
echo $frenchFormatter->format($number); // => 123 456,78 (French format) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const number = 123456.78; | |
const usFormatter = new Intl.NumberFormat("en-US"); | |
console.log(usFormatter.format(number)); // => 123,456.78 (American format) | |
const frenchFormatter = new Intl.NumberFormat("fr-FR"); | |
console.log(frenchFormatter.format(number)); // => 123 456,78 (French format) |