# farmerJoe languages

A central repository for the language files used in farmerjoe

## Installation

```
yarn add @farmerjoeorg/farmerjoe-language
```

## Projects using farmerjoe-language

- [farmerjoe-web](https://github.com/farmerjoeorg/farmerjoe-web)
- [farmerjoe-functions](https://github.com/farmerjoeorg/farmerjoe-functions)
- [farmerjoe-mobile](https://github.com/farmerjoeorg/farmerjoe-mobile)

## How to add a word to translation files

Add **farmerjoe-eu-dev.json** (ask in the team to get it) to the root of the project. Write the object you want to translate and add to translation files in **srcTranslation.json**. Run command ` node ./addTranslation.js [the file you want to add translations]` for example ` node ./addTranslation.js farmerjoe.json`

## CrowdIn Integration

The translations are done using the CrowdIn platform. Currently, its use
is suspended.

## NPM

The package is also available on [NPM](https://www.npmjs.com/package/@farmerjoeorg/farmerjoe-language).
This package is used by [farmerjoe-functions](https://github.com/farmerjoeorg/farmerjoe-functions)
when deploying to firebase functions.

## PRs
After a PR has been approved, please bump the package version manually. The release to NPM will be done automatically. You can then point all affected platforms (mobile, web, functions, ...) to the new version found on [NPM](https://www.npmjs.com/package/@farmerjoeorg/farmerjoe-language).

## Adding new languange
1. Add the new language iso code to the `supportedLanguages.json` and `index.js`;
2. Call the script `addNewLanguage.js`, in order to translate:
```
node ./addNewLanguage.js [new language]
```
3. Modify the `moment.js` by removing the following content:
```javascript
;(function (global, factory) {
   typeof exports === 'object' && typeof module !== 'undefined'
       && typeof require === 'function' ? factory(require('../moment')) :
   typeof define === 'function' && define.amd ? define(['../moment'], factory) :
   factory(global.moment)
}(this, (function (moment) { 'use strict';

    //! moment.js locale configuration

    var bg = moment.defineLocale('bg',
```
then, export it as a module:
```javascript
export default {
    months...
}
```
