Custom labels
This commit is contained in:
parent
563da2779e
commit
8a669fe3fe
|
|
@ -50,6 +50,7 @@ const String kCronsHelpUrl =
|
||||||
'https://invoiceninja.github.io/selfhost.html#cron-configuration';
|
'https://invoiceninja.github.io/selfhost.html#cron-configuration';
|
||||||
const String kGitHubDiffUrl =
|
const String kGitHubDiffUrl =
|
||||||
'https://github.com/invoiceninja/invoiceninja/compare/vVERSION...v5-stable';
|
'https://github.com/invoiceninja/invoiceninja/compare/vVERSION...v5-stable';
|
||||||
|
const String kGitHubLangUrl = 'https://github.com/invoiceninja/invoiceninja/blob/master/resources/lang/en/texts.php';
|
||||||
|
|
||||||
enum AppEnvironment {
|
enum AppEnvironment {
|
||||||
hosted,
|
hosted,
|
||||||
|
|
|
||||||
|
|
@ -1239,9 +1239,6 @@ abstract class SettingsEntity
|
||||||
emailBodyReminderEndless: clientSettings?.emailBodyReminderEndless ??
|
emailBodyReminderEndless: clientSettings?.emailBodyReminderEndless ??
|
||||||
groupSettings?.emailBodyReminderEndless ??
|
groupSettings?.emailBodyReminderEndless ??
|
||||||
companySettings?.emailBodyReminderEndless,
|
companySettings?.emailBodyReminderEndless,
|
||||||
customPaymentTerms: clientSettings?.customPaymentTerms ??
|
|
||||||
groupSettings?.customPaymentTerms ??
|
|
||||||
companySettings?.customPaymentTerms,
|
|
||||||
pdfVariables: clientSettings?.pdfVariables ??
|
pdfVariables: clientSettings?.pdfVariables ??
|
||||||
groupSettings?.pdfVariables ??
|
groupSettings?.pdfVariables ??
|
||||||
companySettings?.pdfVariables,
|
companySettings?.pdfVariables,
|
||||||
|
|
@ -1966,11 +1963,6 @@ abstract class SettingsEntity
|
||||||
@BuiltValueField(wireName: 'portal_custom_js')
|
@BuiltValueField(wireName: 'portal_custom_js')
|
||||||
String get clientPortalCustomJs;
|
String get clientPortalCustomJs;
|
||||||
|
|
||||||
// TODO remove this field
|
|
||||||
@nullable
|
|
||||||
@BuiltValueField(wireName: 'custom_payment_terms')
|
|
||||||
BuiltList<PaymentTermEntity> get customPaymentTerms;
|
|
||||||
|
|
||||||
// TODO remove this field
|
// TODO remove this field
|
||||||
@nullable
|
@nullable
|
||||||
@BuiltValueField(wireName: 'has_custom_design1_HIDDEN')
|
@BuiltValueField(wireName: 'has_custom_design1_HIDDEN')
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -525,7 +525,6 @@ Serializers _$serializers = (new Serializers().toBuilder()
|
||||||
const FullType(BuiltList, const [const FullType(String)])
|
const FullType(BuiltList, const [const FullType(String)])
|
||||||
]),
|
]),
|
||||||
() => new MapBuilder<String, BuiltList<String>>())
|
() => new MapBuilder<String, BuiltList<String>>())
|
||||||
..addBuilderFactory(const FullType(BuiltList, const [const FullType(PaymentTermEntity)]), () => new ListBuilder<PaymentTermEntity>())
|
|
||||||
..addBuilderFactory(const FullType(BuiltMap, const [const FullType(String), const FullType(TaskEntity)]), () => new MapBuilder<String, TaskEntity>())
|
..addBuilderFactory(const FullType(BuiltMap, const [const FullType(String), const FullType(TaskEntity)]), () => new MapBuilder<String, TaskEntity>())
|
||||||
..addBuilderFactory(const FullType(BuiltList, const [const FullType(String)]), () => new ListBuilder<String>())
|
..addBuilderFactory(const FullType(BuiltList, const [const FullType(String)]), () => new ListBuilder<String>())
|
||||||
..addBuilderFactory(const FullType(BuiltMap, const [const FullType(String), const FullType(TaskStatusEntity)]), () => new MapBuilder<String, TaskStatusEntity>())
|
..addBuilderFactory(const FullType(BuiltMap, const [const FullType(String), const FullType(TaskStatusEntity)]), () => new MapBuilder<String, TaskStatusEntity>())
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,11 @@ import 'package:invoiceninja_flutter/ui/app/forms/app_form.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/forms/bool_dropdown_button.dart';
|
import 'package:invoiceninja_flutter/ui/app/forms/bool_dropdown_button.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/settings/localization_vm.dart';
|
import 'package:invoiceninja_flutter/ui/settings/localization_vm.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/edit_scaffold.dart';
|
import 'package:invoiceninja_flutter/ui/app/edit_scaffold.dart';
|
||||||
|
import 'package:invoiceninja_flutter/utils/dialogs.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||||
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||||
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
class LocalizationSettings extends StatefulWidget {
|
class LocalizationSettings extends StatefulWidget {
|
||||||
const LocalizationSettings({
|
const LocalizationSettings({
|
||||||
|
|
@ -250,6 +252,8 @@ class _LocalizationSettingsState extends State<LocalizationSettings>
|
||||||
children: [
|
children: [
|
||||||
FormCard(
|
FormCard(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
children: [
|
children: [
|
||||||
DropdownButtonHideUnderline(
|
DropdownButtonHideUnderline(
|
||||||
child: DropdownButton<String>(
|
child: DropdownButton<String>(
|
||||||
|
|
@ -266,6 +270,28 @@ class _LocalizationSettingsState extends State<LocalizationSettings>
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
SizedBox(width: 8),
|
||||||
|
FlatButton(
|
||||||
|
child: Text(localization.addCustom),
|
||||||
|
onPressed: () {
|
||||||
|
fieldCallback(
|
||||||
|
context: context,
|
||||||
|
callback: (value) {
|
||||||
|
viewModel.onSettingsChanged(settings.rebuild(
|
||||||
|
(b) => b..translations[value] = ''));
|
||||||
|
},
|
||||||
|
field: localization.label,
|
||||||
|
title: localization.addCustom,
|
||||||
|
secondaryActions: [
|
||||||
|
FlatButton(
|
||||||
|
child: Text(localization.labels.toUpperCase()),
|
||||||
|
onPressed: () => launch(kGitHubLangUrl),
|
||||||
|
)
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
SizedBox(height: 16),
|
SizedBox(height: 16),
|
||||||
for (var key in translations.keys)
|
for (var key in translations.keys)
|
||||||
Row(
|
Row(
|
||||||
|
|
|
||||||
|
|
@ -156,6 +156,7 @@ void fieldCallback({
|
||||||
String field,
|
String field,
|
||||||
Function(String) callback,
|
Function(String) callback,
|
||||||
int maxLength,
|
int maxLength,
|
||||||
|
List<FlatButton> secondaryActions,
|
||||||
}) {
|
}) {
|
||||||
showDialog<AlertDialog>(
|
showDialog<AlertDialog>(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
@ -166,6 +167,7 @@ void fieldCallback({
|
||||||
field: field,
|
field: field,
|
||||||
title: title,
|
title: title,
|
||||||
maxLength: maxLength,
|
maxLength: maxLength,
|
||||||
|
secondaryActions: secondaryActions,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
@ -177,12 +179,14 @@ class FieldConfirmation extends StatefulWidget {
|
||||||
@required this.title,
|
@required this.title,
|
||||||
@required this.field,
|
@required this.field,
|
||||||
this.maxLength,
|
this.maxLength,
|
||||||
|
this.secondaryActions,
|
||||||
});
|
});
|
||||||
|
|
||||||
final Function(String) callback;
|
final Function(String) callback;
|
||||||
final String title;
|
final String title;
|
||||||
final String field;
|
final String field;
|
||||||
final int maxLength;
|
final int maxLength;
|
||||||
|
final List<FlatButton> secondaryActions;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_FieldConfirmationState createState() => _FieldConfirmationState();
|
_FieldConfirmationState createState() => _FieldConfirmationState();
|
||||||
|
|
@ -213,6 +217,8 @@ class _FieldConfirmationState extends State<FieldConfirmation> {
|
||||||
onSubmitted: (value) => _submit(),
|
onSubmitted: (value) => _submit(),
|
||||||
),
|
),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
|
...widget.secondaryActions ?? [],
|
||||||
|
SizedBox(width: 6),
|
||||||
SaveCancelButtons(
|
SaveCancelButtons(
|
||||||
isHeader: false,
|
isHeader: false,
|
||||||
saveLabel: localization.save.toUpperCase(),
|
saveLabel: localization.save.toUpperCase(),
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
static final Map<String, Map<String, String>> _localizedValues = {
|
static final Map<String, Map<String, String>> _localizedValues = {
|
||||||
'en': {
|
'en': {
|
||||||
// STARTER: lang key - do not remove comment
|
// STARTER: lang key - do not remove comment
|
||||||
|
'labels': 'Labels',
|
||||||
|
'add_custom': 'Add Custom',
|
||||||
'payment_tax': 'Payment Tax',
|
'payment_tax': 'Payment Tax',
|
||||||
'unpaid': 'Unpaid',
|
'unpaid': 'Unpaid',
|
||||||
'white_label': 'White Label',
|
'white_label': 'White Label',
|
||||||
|
|
@ -5217,6 +5219,10 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
|
|
||||||
String get paymentTax => _localizedValues[localeCode]['payment_tax'] ?? '';
|
String get paymentTax => _localizedValues[localeCode]['payment_tax'] ?? '';
|
||||||
|
|
||||||
|
String get addCustom => _localizedValues[localeCode]['add_custom'] ?? '';
|
||||||
|
|
||||||
|
String get labels => _localizedValues[localeCode]['labels'] ?? '';
|
||||||
|
|
||||||
String lookup(String key) {
|
String lookup(String key) {
|
||||||
final lookupKey = toSnakeCase(key);
|
final lookupKey = toSnakeCase(key);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -557,7 +557,7 @@ packages:
|
||||||
name: intl
|
name: intl
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.17.0-nullsafety.2"
|
version: "0.16.1"
|
||||||
io:
|
io:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
||||||
|
|
@ -64,8 +64,8 @@ dependencies:
|
||||||
extended_image: 1.3.1-dev #TODO remove
|
extended_image: 1.3.1-dev #TODO remove
|
||||||
|
|
||||||
# https://github.com/flutter/flutter/issues/70433#issuecomment-727154345
|
# https://github.com/flutter/flutter/issues/70433#issuecomment-727154345
|
||||||
dependency_overrides:
|
#dependency_overrides:
|
||||||
intl: ^0.17.0-nullsafety.2
|
#vf intl: ^0.17.0-nullsafety.2
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_driver:
|
flutter_driver:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue