elxris / Turnip-Calculator

ACNH Turnip Calculator Responsive Web App
https://ac-turnip.com
MIT License
618 stars 100 forks source link

ACNH Turnip Calculator

Calculate your turnip price patterns and gain the most from the stalk market!

You can find the live calculator here.

API

Looking for an API? See this

Local Development

To run this application locally, run the following commands:

git clone git@github.com:elxris/Turnip-Calculator.git
cd Turnip-Calculator
npm i
npm start

Localizations

For translators

Please go to i18n.ac-turnip.com to start translating.

For developers

This app supports dynamic localization using i18next and react-i18next, with i18next-browser-languagedetector to automatically detect the user's native OS language preferences and switch the app's language accordingly.

Adding new text to localizations

As features are added to the calculator, they'll most likely not be localised immediately. To localise any new text in the app, make sure to first wrap the text in the t() method taken from the useTranslation() hook. Then, in your language's translation.json, add a new JSON key/value pair with the key used in the t() method, using your translated text as the value.

For example, let's say we're adding a new button that says "Show Current Pattern". In the component where that text would be displayed, you would instead write t("Show Current Pattern"), wrapping the statement in brackets {} if it were part of JSX code.

Then, to add a translation to your language, you'd go to your languages translation.json file, and add the following line (using Spanish as an example):

"Show Current Pattern": "Mostrar Patrón Actual",

If no key is specified in the localization files, the app will simply display whatever text is passed into t(), to avoid errors.

Creating new localizations

To localise the app to a new language, the following simple steps need to be done:

The localization is now ready to deploy and will appear to users who use your language for their browser.