Skip to content

Commit

Permalink
Merge branch 'master' into fix/VC/pt-BR
Browse files Browse the repository at this point in the history
  • Loading branch information
likeavirgil authored May 31, 2022
2 parents 3ee9075 + 96004b2 commit 7dfa033
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 57 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/node-pretest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: 'Tests: pretest/posttest'

on: [pull_request, push]

jobs:
tests:
uses: ljharb/actions/.github/workflows/pretest.yml@main

18 changes: 18 additions & 0 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 'Tests: node.js'

on: [pull_request, push]

jobs:
tests:
uses: ljharb/actions/.github/workflows/node.yml@main
with:
range: '>= 0.8'
type: majors
command: npm run tests-only

node:
name: 'node.js tests'
needs: [tests]
runs-on: ubuntu-latest
steps:
- run: 'echo tests completed'
15 changes: 15 additions & 0 deletions .github/workflows/rebase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Automatic Rebase

on: [pull_request_target]

jobs:
_:
name: "Automatic Rebase"

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: ljharb/rebase@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12 changes: 12 additions & 0 deletions .github/workflows/require-allow-edits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Require “Allow Edits”

on: [pull_request_target]

jobs:
_:
name: "Require “Allow Edits”"

runs-on: ubuntu-latest

steps:
- uses: ljharb/require-allow-edits@main
52 changes: 0 additions & 52 deletions .travis.yml

This file was deleted.

13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
"main": "index.js",
"scripts": {
"prepublish": "safe-publish-latest",
"pretest": "npm run --silent lint",
"test": "npm run --silent tests-only",
"tests-only": "mocha test/*.js --reporter spec",
"lint": "eslint *.js test/*.js",
"pretest": "npm run lint",
"test": "npm run tests-only",
"tests-only": "nyc mocha test/*.js --reporter spec",
"posttest": "aud --production",
"lint": "eslint .",
"docs": "docco -o docs/ index.js"
},
"repository": {
Expand All @@ -33,12 +34,14 @@
"warning": "^4.0.3"
},
"devDependencies": {
"chai": "^4.3.4",
"aud": "^2.0.0",
"chai": "^3.5.0",
"docco": "^0.7.0",
"eslint": "^7.32.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.23.4",
"mocha": "^3.5.3",
"nyc": "^10.3.2",
"safe-publish-latest": "^1.1.4",
"uglify-js": "^2.7.3"
},
Expand Down
20 changes: 20 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,26 @@ describe('locale-specific pluralization rules', function () {
expect(polyglot.t('n_votes', 102)).to.equal('102 صوت');
});

it('interpolates properly in Arabic', function () {
var phrases = {
hello: 'الرمز ${code} غير صحيح' // eslint-disable-line no-template-curly-in-string
};

var polyglot = new Polyglot({
phrases: phrases,
locale: 'ar',
interpolation: { prefix: '${', suffix: '}' }
});

expect(polyglot.t('hello', { code: 'De30Niro' })).to.equal('الرمز De30Niro غير صحيح');

// note how the "30" in the next line shows up in the wrong place:
expect(polyglot.t('hello', { code: '30DeNiro' })).to.equal('الرمز 30DeNiro غير صحيح');
// but with a directional marker character, it shows up in the right place:
expect(polyglot.t('hello', { code: '\u200E30DeNiroMarker' })).to.equal('الرمز \u200E30DeNiroMarker غير صحيح');
// see https://github.com/airbnb/polyglot.js/issues/167 / https://stackoverflow.com/a/34903965 for why it's impractical to handle in polyglot
});

it('pluralizes in Russian', function () {
// English would be: "1 vote" / "%{smart_count} votes"
var whatSomeoneTranslated = [
Expand Down

0 comments on commit 7dfa033

Please sign in to comment.