cwtch-ui/README.md

83 lines
2.8 KiB
Markdown
Raw Normal View History

2021-06-25 00:24:39 +00:00
# Cwtch UI
2021-06-24 23:10:45 +00:00
2021-06-25 15:01:26 +00:00
A Flutter based [Cwtch](https://cwtch.im) UI.
This README covers build instructions, for information on Cwtch itself please go to [https://cwtch.im](https://cwtch.im)
2021-06-24 23:10:45 +00:00
## Getting Started
2021-06-25 15:01:26 +00:00
First you will need a valid [flutter sdk installation](https://flutter.dev/docs/get-started/install)
and run `flutter pub get` to fetch dependencies.
You will probably want to disable Analytics on the Flutter Tool: `flutter config --no-analytics`
2021-06-24 23:10:45 +00:00
2021-06-25 15:01:26 +00:00
### Building on Linux (for Linux)
2021-06-24 23:10:45 +00:00
2021-06-25 15:01:26 +00:00
- run `fetch-libcwtch-go.sh`libCwtch-go to fetch a prebuild version of `libCwtch-go.so` go to `./linux`. Include `./linux` in `LD_LIBRARY_PATH`
- run `fetch-tor.sh` and/or ensure that `tor` is in `$PATH`
- run `flutter run -d linux`
2021-06-24 23:10:45 +00:00
2021-06-25 15:01:26 +00:00
### Building on Windows (for Windows)
2021-06-24 23:10:45 +00:00
2021-06-25 15:01:26 +00:00
- run `fetch-libcwtch-go.ps1` to fetch a prebuild version of `libCwtch.dll`
2021-06-24 23:10:45 +00:00
- run `fetch-tor-win.ps1` to fetch Tor for windows
2021-06-25 15:01:26 +00:00
- run `flutter run -d windows`
### Building on Linux/Windows (for Android)
- Follow the steps above to fetch `libCwtch-go` and `tor` (these will fetch Android versions of these binaries also)
- run `flutter run` with an Android phone connect via USB (or some other valid debug mode)
2021-06-24 23:10:45 +00:00
2021-06-25 15:01:26 +00:00
#### Known Platform Issues
2021-06-24 23:10:45 +00:00
2021-06-25 15:01:26 +00:00
- **Windows**: Flutter engine has a [known bug](https://github.com/flutter/flutter/issues/75675) around the Right Shift key being sticky.
We have implemented a partial workaround, if this happens, tap left shift and it will reset.
2021-06-24 23:10:45 +00:00
2021-06-25 15:01:26 +00:00
## l10n Instructions
2021-06-24 23:10:45 +00:00
### Adding a new string
Strings are managed directly from our Lokalise(url?) project.
Keys should be valid Dart variable names in lowerCamelCase.
After adding a new key and providing/obtaining translations for it, follow the next step to update your local copy.
### Updating translations
Only Open Privacy staff members can update translations.
In Lokalise, hit Download and make sure:
* Format is set to "Flutter (.arb)
* Output filename is set to `l10n/intl_%LANG_ISO%.%FORMAT%`
* Empty translations is set to "Replace with base language"
Build, download and unzip the output, overwriting `lib/l10n`. The next time Flwtch is built, Flutter will notice the changes and update `app_localizations.dart` accordingly (thanks to `generate:true` in `pubspec.yaml`).
### Adding a language
If a new language has been added to the Lokalise project, two additional manual steps need to be done:
* Create a new key called `localeXX` for the name of the language
* Add it to the settings pane by updating `getLanguageFull()` in `lib/views/globalsettingsview.dart`
Then rebuild as normal.
### Using a string
Any widget underneath the main MaterialApp should be able to:
```
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
```
and then use:
```
Text(AppLocalizations.of(context)!.stringIdentifer),
```
### Configuration
With `generate: true` in `pubspec.yaml`, the Flutter build process checks `l10n.yaml` for input/output filenames.