Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
Set explicit ltr direction for pages untranslated in rtl languages (#434
Browse files Browse the repository at this point in the history
)

* Set explicit ltr direction for pages untranslated in rtl languages

* Only override locales that would otherwise use Eastern Arabic numerals
  • Loading branch information
sarayourfriend authored Nov 29, 2021
1 parent d803498 commit a821eb0
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/pages/about.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="section">
<div class="section" dir="ltr">
<div :class="['container', isEmbedded ? '' : 'is-fluid']">
<div>
<h1 class="text-5xl mb-10">
Expand Down
2 changes: 1 addition & 1 deletion src/pages/extension.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div>
<div dir="ltr">
<div class="hero-section border-b">
<div class="container pt-16" :class="[isEmbedded ? '' : 'is-fluid']">
<div class="intro text-center mx-auto">
Expand Down
2 changes: 1 addition & 1 deletion src/pages/feedback.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="section">
<div class="section" dir="ltr">
<div :class="['container', isEmbedded ? '' : 'is-fluid']">
<div class="pb-6">
<h1 id="feedback" class="text-5xl mb-10">
Expand Down
2 changes: 1 addition & 1 deletion src/pages/meta-search.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="section mb-10">
<div class="section mb-10" dir="ltr">
<div :class="['container', isEmbedded ? '' : 'is-fluid']">
<div class="mb-10">
<h1 class="text-5xl">
Expand Down
2 changes: 1 addition & 1 deletion src/pages/search-help.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="section">
<div class="section" dir="ltr">
<div :class="['container', isEmbedded ? '' : 'is-fluid']">
<div class="mb-10">
<h1 class="text-5xl mb-10">
Expand Down
16 changes: 14 additions & 2 deletions src/pages/sources.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="section">
<div class="section" dir="ltr">
<div :class="['container', isEmbedded ? '' : 'is-fluid']">
<div class="mb-10">
<h1 class="text-5xl mb-10">
Expand Down Expand Up @@ -138,6 +138,8 @@ import sortBy from 'lodash.sortby'
import { mapState } from 'vuex'
import { NAV, PROVIDER } from '~/constants/store-modules'
const ARABIC_NUMERAL_LOCALES = ['ar', 'fa', 'ur', 'ckb', 'ps']
const SourcePage = {
name: 'source-page',
layout({ store }) {
Expand All @@ -162,8 +164,18 @@ const SourcePage = {
},
},
methods: {
/**
* @param {number} imageCount
*/
getProviderImageCount(imageCount) {
return imageCount.toLocaleString(this.$i18n.locale)
let locale = this.$i18n.locale
if (ARABIC_NUMERAL_LOCALES.some((l) => locale.startsWith(l))) {
// most sites with RTL language with numbers continue to use Western Arabic Numerals whereas `toLocaleString` will use Eastern Arabic Numerals for Arabic and Hebrew by default
// Prevent formatting using Eastern Arabic Numerals and use `en-GB` to match the most common decimal and thousands delimiters for those regions
// https://en.wikipedia.org/wiki/Decimal_separator#Countries_using_decimal_point
locale = 'en-GB'
}
return imageCount.toLocaleString(locale)
},
sortTable(field) {
let direction = 'asc'
Expand Down

0 comments on commit a821eb0

Please sign in to comment.