Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: format code #19

Merged
merged 1 commit into from
Aug 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/with-react-intl/next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
}
reactStrictMode: true,
};

module.exports = nextConfig
module.exports = nextConfig;
28 changes: 14 additions & 14 deletions examples/with-react-intl/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ import { generateENXD, pseudoIntl } from '@cungminh2710/pseudolocalize';
import { IntlProvider, RawIntlProvider } from 'react-intl';

function MyApp({ Component, pageProps }: AppProps) {
if (process.env.NODE_ENV === 'development') {
const intl = pseudoIntl(generateENXD, messages, 'en');
return (
<RawIntlProvider value={intl}>
<Component {...pageProps} />
</RawIntlProvider>
);
} else {
return (
<IntlProvider messages={messages} locale="en">
<Component {...pageProps} />
</IntlProvider>
);
}
if (process.env.NODE_ENV === 'development') {
const intl = pseudoIntl(generateENXD, messages, 'en');
return (
<RawIntlProvider value={intl}>
<Component {...pageProps} />
</RawIntlProvider>
);
} else {
return (
<IntlProvider messages={messages} locale='en'>
<Component {...pageProps} />
</IntlProvider>
);
}
}

export default MyApp;
130 changes: 65 additions & 65 deletions examples/with-react-intl/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,77 +5,77 @@ import { FormattedMessage } from 'react-intl';
import styles from '../styles/Home.module.css';

const Home: NextPage = () => {
return (
<div className={styles.container}>
<Head>
<title>
<FormattedMessage defaultMessage="Create Next App" />
</title>
<meta name="description" content="Generated by create next app" />
<link rel="icon" href="/favicon.ico" />
</Head>
return (
<div className={styles.container}>
<Head>
<title>
<FormattedMessage defaultMessage='Create Next App' />
</title>
<meta name='description' content='Generated by create next app' />
<link rel='icon' href='/favicon.ico' />
</Head>

<main className={styles.main}>
<h1 className={styles.title}>
<FormattedMessage defaultMessage="Welcome!" />
</h1>
<main className={styles.main}>
<h1 className={styles.title}>
<FormattedMessage defaultMessage='Welcome!' />
</h1>

<div className={styles.grid}>
<a href="https://nextjs.org/docs" className={styles.card}>
<h2>
<FormattedMessage defaultMessage="Documentation" />
</h2>
<p>
<FormattedMessage defaultMessage="Find in-depth information about Next.js features and API." />
</p>
</a>
<div className={styles.grid}>
<a href='https://nextjs.org/docs' className={styles.card}>
<h2>
<FormattedMessage defaultMessage='Documentation' />
</h2>
<p>
<FormattedMessage defaultMessage='Find in-depth information about Next.js features and API.' />
</p>
</a>

<a href="https://nextjs.org/learn" className={styles.card}>
<h2>
<FormattedMessage defaultMessage="Learn" />
</h2>
<p>
<FormattedMessage defaultMessage="Learn about Next.js in an interactive course with quizzes!" />
</p>
</a>
<a href='https://nextjs.org/learn' className={styles.card}>
<h2>
<FormattedMessage defaultMessage='Learn' />
</h2>
<p>
<FormattedMessage defaultMessage='Learn about Next.js in an interactive course with quizzes!' />
</p>
</a>

<a href="https://github.com/vercel/next.js/tree/canary/examples" className={styles.card}>
<h2>
<FormattedMessage defaultMessage="Examples" />
</h2>
<p>
<FormattedMessage defaultMessage="Discover and deploy boilerplate example Next.js projects." />
</p>
</a>
<a href='https://github.com/vercel/next.js/tree/canary/examples' className={styles.card}>
<h2>
<FormattedMessage defaultMessage='Examples' />
</h2>
<p>
<FormattedMessage defaultMessage='Discover and deploy boilerplate example Next.js projects.' />
</p>
</a>

<a
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
className={styles.card}
>
<h2>
<FormattedMessage defaultMessage="Deploy" />
</h2>
<p>
<FormattedMessage defaultMessage="Instantly deploy your Next.js site to a public URL with Vercel." />
</p>
</a>
</div>
</main>
<a
href='https://vercel.com/new?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app'
className={styles.card}
>
<h2>
<FormattedMessage defaultMessage='Deploy' />
</h2>
<p>
<FormattedMessage defaultMessage='Instantly deploy your Next.js site to a public URL with Vercel.' />
</p>
</a>
</div>
</main>

<footer className={styles.footer}>
<a
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<FormattedMessage defaultMessage="Powered by" />{' '}
<span className={styles.logo}>
<Image src="/vercel.svg" alt="Vercel Logo" width={72} height={16} />
</span>
</a>
</footer>
</div>
);
<footer className={styles.footer}>
<a
href='https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app'
target='_blank'
rel='noopener noreferrer'
>
<FormattedMessage defaultMessage='Powered by' />{' '}
<span className={styles.logo}>
<Image src='/vercel.svg' alt='Vercel Logo' width={72} height={16} />
</span>
</a>
</footer>
</div>
);
};

export default Home;
8 changes: 4 additions & 4 deletions src/__tests__/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ const input = 'my name is {name}';
const name = 'Minh';

test('en-XA', () => {
expect(new IntlMessageFormat(generateENXA(input)).format({ name })).toBe('ṁẏ ńâṁè íś Minh');
expect(new IntlMessageFormat(generateENXA(input)).format({ name })).toBe('ṁẏ ńâṁè íś Minh');
});

test('en-XB', () => {
expect(new IntlMessageFormat(generateENXB(input)).format({ name })).toBe('[!! ṁẏ ńâṁṁṁè íííś !!]Minh');
expect(new IntlMessageFormat(generateENXB(input)).format({ name })).toBe('[!! ṁẏ ńâṁṁṁè íííś !!]Minh');
});

test('en-XC', () => {
expect(new IntlMessageFormat(generateENXC(input)).format({ name })).toBe('မြ······ṁẏ ńâṁè íś Minh······မြ');
expect(new IntlMessageFormat(generateENXC(input)).format({ name })).toBe('မြ······ṁẏ ńâṁè íś Minh······မြ');
});

test('en-XD', () => {
expect(new IntlMessageFormat(generateENXD(input)).format({ name })).toBe('မြ······mẏ nâmè ís Minh······မြ');
expect(new IntlMessageFormat(generateENXD(input)).format({ name })).toBe('မြ······mẏ nâmè ís Minh······မြ');
});
Loading