Skip to content

Commit

Permalink
Applanga Command Line Interface Version 1.0.91
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and Jenkins committed Dec 7, 2023
1 parent 26ae191 commit d8e96c3
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
*Applanga CLI Documentation:* <https://www.applanga.com/docs-integration/cli>
***

### Version 1.0.91 (7 Dec 2023)
#### Added
- Added `remove_cr_char` option

### Version 1.0.89 (7 Aug 2023)
#### Added
- Improved pull command to retrieve localization changes immediately
Expand Down
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Applanga Localization Command Line Interface (CLI)

***
*Version:* 1.0.89
*Version:* 1.0.91

*Website:* <https://www.applanga.com>

Expand All @@ -12,7 +12,7 @@

1. [Installation](#installation)
2. [Initialization](#initialize-project)
3. [Usage](#push-pull-translation-files)
3. [Usage](#push-and-pull-translation-files)
4. [Configuration](#configuration)
5. [Configuration Examples](#configuration-examples)
- [Android Examples](#android-configuration-examples)
Expand Down Expand Up @@ -53,13 +53,13 @@ To update to the latest version call:
```

###### Installing on Mac pre-MacOS 11
Please note that in order to run the latest Applanga CLI version on macOS you need to have at least macOS 11 (Big Sur) installed. If you have an older macOS you can use [Applanga CLI 1.0.89](https://github.com/applanga/applanga-cli/releases/tag/1.0.51) but be aware that not all features and fixes are available in that version. Please check the [Applanga CLI 1.0.51 README](https://github.com/applanga/applanga-cli/blob/1.0.51/README.md) and [CHANGELOG](https://www.applanga.com/changelog/cli) for more details.
Please note that in order to run the latest Applanga CLI version on macOS you need to have at least macOS 11 (Big Sur) installed. If you have an older macOS you can use [Applanga CLI 1.0.51](https://github.com/applanga/applanga-cli/releases/tag/1.0.51) but be aware that not all features and fixes are available in that version. Please check the [Applanga CLI 1.0.51 README](https://github.com/applanga/applanga-cli/blob/1.0.51/README.md) and [CHANGELOG](https://www.applanga.com/changelog/cli) for more details.

In order to install this via brew you need to run:

```sh
brew tap applanga/cli
brew install applanga@1.0.89
brew install applanga@1.0.51
```

##### Github
Expand All @@ -80,7 +80,7 @@ In the dialog that appears, project data like the API token and the type of proj
It will then save all the data to a configuration file in the current directory with the name `.applanga.json`


## Push & Pull Translation Files
## Push and Pull Translation Files

The translations can simply be pushed to and pulled from Applanga with the corresponding commands.

Expand Down Expand Up @@ -229,7 +229,7 @@ It is possible to set the variable `<language>` in the path. In the "source" blo

- **"branch_id"**:

Defines the branch to use for the configuration. If the branch_id is not set, the default branch will be used. This will only work for Projects where branching is enabled. You can find the branch id in the **Project Settings** page.
Defines the branch to use for the configuration. If the branch_id is not set, the "main" branch will be used. This will only work for Projects where branching is enabled. You can find the branch id in the **Project Settings** page.

To learn more about branching, please see the [Branching Documentation.](www.applanga.com/docs/advanced-features/branching)

Expand Down Expand Up @@ -402,6 +402,14 @@ It is possible to set the variable `<language>` in the path. In the "source" blo
The keys in files downloaded on pull or **pullsource** command are sorted alphabetically. This option is by default set to `false`.

***Example:*** `"sort_by_key": true`

- **"remove_cr_char"**

If the value is set to `true` the line endings in uploaded content will follow the Unicode and Mac new line format containing just the line feed character (LF, escape sequence \n). If present, any carriage return characters (CR, the escape sequence \r) will be removed.

In download when the option set to `true`, the downloded files will contain only the Unicode/Mac new line character (LF).

***Example:*** `"remove_cr_char": true`

# Configuration Examples
---
Expand Down
10 changes: 10 additions & 0 deletions lib/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ def downloadFile(file_data, debug=False):
if file_data['sort_by_key'] == True:
request_options['sortByKey'] = True

if 'remove_cr_char' in file_data:
if file_data['remove_cr_char'] == True:
request_options['removeCrChar'] = True

try:
# Request the file from server
request_data = {
Expand Down Expand Up @@ -242,6 +246,9 @@ def uploadFiles(upload_files, force=False, draft=False, debug=False):
if 'disable_plurals' in file_data:
send_data['disable_plurals'] = file_data['disable_plurals']

if 'remove_cr_char' in file_data:
send_data['removeCrChar'] = file_data['remove_cr_char']

response = uploadFile(send_data, force=force, draft=draft, debug=debug)
return_data.append(
{
Expand Down Expand Up @@ -285,6 +292,9 @@ def uploadFile(file_data, force=False, draft=False, debug=False):
if file_data['file_format'] in ['nested_json', 'react_nested_json'] and 'disable_plurals' in file_data:
request_options['disablePlurals'] = file_data['disable_plurals'] is True

if 'removeCrChar' in file_data:
request_options['removeCrChar'] = file_data['removeCrChar']

request_data = {
'file-format': file_data['file_format'],
'language': file_data['language'],
Expand Down
2 changes: 1 addition & 1 deletion lib/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NUMBER = '1.0.89'
VERSION_NUMBER = '1.0.91'
APPLANGA_HOST = 'https://api.applanga.com'
API_BASE_PATH = '/v1/api'
CONFIG_FILE_NAME = '.applanga.json'
Expand Down
2 changes: 2 additions & 0 deletions lib/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ def getFiles(source):
return_files[file]['file_format'] = source['file_format']
if 'key_prefix' in source:
return_files[file]['key_prefix'] = source['key_prefix']
if 'remove_cr_char' in source:
return_files[file]['remove_cr_char'] = source['remove_cr_char']

if 'disable_plurals' in source:
return_files[file]['disable_plurals'] = source['disable_plurals']
Expand Down

0 comments on commit d8e96c3

Please sign in to comment.