🐛 Certains navigateurs ne sont pas encore internationalisés

Intl fait planter Safari sur certains iphones, e.g. le 6
pull/166/head
mama 2018-02-05 17:01:33 +01:00
parent a4005dd982
commit b1f446da4d
5 changed files with 29 additions and 27 deletions

View File

@ -21,9 +21,8 @@ import { Link } from 'react-router-dom'
import { formValueSelector } from 'redux-form'
import './Results.css'
import '../engine/mecanismViews/Somme.css'
import { humanFigure } from './rule/RuleValueVignette'
import { capitalise0 } from '../utils'
import { capitalise0, humanFigure } from '../utils'
import { nameLeaf, encodeRuleName } from 'Engine/rules'
// Filtered variables and rules can't be filtered in a uniform way, for now

View File

@ -5,7 +5,7 @@ import { AttachDictionary } from '../AttachDictionary'
import knownMecanisms from 'Engine/known-mecanisms.yaml'
import { makeJsx } from 'Engine/evaluation'
import './Algorithm.css'
import { humanFigure } from './RuleValueVignette'
import { humanFigure } from '../../utils'
let RuleWithoutFormula = () => [
<p>
@ -29,24 +29,22 @@ export default class Algorithm extends React.Component {
return (
<div id="algorithm">
<section id="rule-rules" className={classNames({ showValues })}>
{
do {
// TODO ce let est incompréhensible !
let applicabilityMecanisms = values(rule).filter(
v => v && v['rulePropType'] == 'cond'
)
applicabilityMecanisms.length > 0 && (
<section id="declenchement">
<h2>Déclenchement</h2>
<ul>
{applicabilityMecanisms.map(v => (
<li key={v.name}>{makeJsx(v)}</li>
))}
</ul>
</section>
)
}
}
{do {
// TODO ce let est incompréhensible !
let applicabilityMecanisms = values(rule).filter(
v => v && v['rulePropType'] == 'cond'
)
applicabilityMecanisms.length > 0 && (
<section id="declenchement">
<h2>Déclenchement</h2>
<ul>
{applicabilityMecanisms.map(v => (
<li key={v.name}>{makeJsx(v)}</li>
))}
</ul>
</section>
)
}}
<section id="formule">
<h2>
Calcul

View File

@ -2,9 +2,8 @@ import React from 'react'
import { Link } from 'react-router-dom'
import { encodeRuleName } from 'Engine/rules'
import classNames from 'classnames'
let fmt = new Intl.NumberFormat('fr-FR').format
export let humanFigure = decimalDigits => value =>
fmt(value.toFixed(decimalDigits))
import { humanFigure } from '../../utils'
import './RuleValueVignette.css'
import ReactCSSTransitionGroup from 'react-addons-css-transition-group'

View File

@ -6,3 +6,9 @@ export let getIframeOption = optionName => {
hasOption = url.includes(optionName + '=')
return hasOption && url.split(optionName + '=')[1].split('&')[0]
}
export let fmt =
'Intl' in window ? new Intl.NumberFormat('fr-FR').format : v => v
export let humanFigure = decimalDigits => value =>
fmt(value.toFixed(decimalDigits))

View File

@ -75,9 +75,9 @@ module.exports = {
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
loader: prodEnv ?
'url-loader?limit=10000&name=images/[name].[ext]!img-loader?progressive=true' :
'url-loader?limit=10000&name=images/[name].[ext]'
loader: prodEnv
? 'url-loader?limit=10000&name=images/[name].[ext]!img-loader?progressive=true'
: 'url-loader?limit=10000&name=images/[name].[ext]'
},
{
test: /\.ne$/,