Skip to content

Commit

Permalink
Run go mod tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
atavism committed May 24, 2024
2 parents c0dce72 + cb60884 commit d309c99
Show file tree
Hide file tree
Showing 84 changed files with 49 additions and 20,944 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ All those dependencies must be in your PATH
* Only necessary for testing Replica
* CMake 3.22.1
* You can get this from Android SDK Manager

* [CocoaPods](https://cocoapods.org/)
* Possibly this is only needed on Apple platforms.

### 🚀 Setup Project:

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions desktop/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ func (app *App) GetLanguage() string {
// SetLanguage sets the user language
func (app *App) SetLanguage(lang string) {
app.settings.SetLanguage(lang)
log.Debugf("Setting language to %v", lang)
if app.ws != nil {
app.ws.SendMessage("pro", map[string]interface{}{
"type": "pro",
Expand Down
46 changes: 24 additions & 22 deletions desktop/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"github.com/getlantern/flashlight/v7/ops"
"github.com/getlantern/flashlight/v7/proxied"
"github.com/getlantern/golog"
"github.com/getlantern/i18n"
"github.com/getlantern/jibber_jabber"
"github.com/getlantern/lantern-client/desktop/app"
"github.com/getlantern/lantern-client/desktop/autoupdate"
Expand Down Expand Up @@ -119,7 +118,7 @@ func start() {

go func() {
defer logging.Close()
i18nInit(a)
// i18nInit(a)
a.Run(true)

err := a.WaitForExit()
Expand Down Expand Up @@ -435,7 +434,8 @@ func storeVersion() *C.char {

//export lang
func lang() *C.char {
lang := a.Settings().GetLanguage()
lang := a.GetLanguage()
log.Debugf("DEBUG: Language is %v", lang)
if lang == "" {
// Default language is English
lang = defaultLocale
Expand Down Expand Up @@ -673,25 +673,27 @@ func useOSLocale() (string, error) {
return userLocale, nil
}

func i18nInit(a *app.App) {
i18n.SetMessagesFunc(func(filename string) ([]byte, error) {
return a.GetTranslations(filename)
})
locale := a.GetLanguage()
log.Debugf("Using locale: %v", locale)
if _, err := i18n.SetLocale(locale); err != nil {
log.Debugf("i18n.SetLocale(%s) failed, fallback to OS default: %q", locale, err)

// On startup GetLanguage will return '' We use the OS locale instead and make sure the language is
// populated.
if locale, err := useOSLocale(); err != nil {
log.Debugf("i18n.UseOSLocale: %q", err)
a.SetLanguage(defaultLocale)
} else {
a.SetLanguage(locale)
}
}
}
//Do not need to call this function
// Since localisation is happing on client side
// func i18nInit(a *app.App) {
// i18n.SetMessagesFunc(func(filename string) ([]byte, error) {
// return a.GetTranslations(filename)
// })
// locale := a.GetLanguage()
// log.Debugf("Using locale: %v", locale)
// if _, err := i18n.SetLocale(locale); err != nil {
// log.Debugf("i18n.SetLocale(%s) failed, fallback to OS default: %q", locale, err)

// // On startup GetLanguage will return '' We use the OS locale instead and make sure the language is
// // populated.
// if locale, err := useOSLocale(); err != nil {
// log.Debugf("i18n.UseOSLocale: %q", err)
// a.SetLanguage(defaultLocale)
// } else {
// a.SetLanguage(locale)
// }
// }
// }

// Handle system signals for clean exit
func handleSignals(a *app.App) {
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ replace github.com/eycorsican/go-tun2socks => github.com/getlantern/go-tun2socks
require (
github.com/blang/semver v3.5.1+incompatible
github.com/dustin/go-humanize v1.0.1
github.com/eycorsican/go-tun2socks v1.16.11
github.com/eycorsican/go-tun2socks v1.16.12-0.20201107203946-301549c435ff
github.com/fsnotify/fsnotify v1.6.0
github.com/getlantern/appdir v0.0.0-20200615192800-a0ef1968f4da
github.com/getlantern/autoupdate v0.0.0-20211217175350-d0b211f39ba7
Expand All @@ -42,7 +42,7 @@ require (
github.com/getlantern/eventual v1.0.0
github.com/getlantern/eventual/v2 v2.0.2
github.com/getlantern/filepersist v0.0.0-20210901195658-ed29a1cb0b7c
github.com/getlantern/flashlight/v7 v7.6.78-0.20240515232243-b037ce6b98a4
github.com/getlantern/flashlight/v7 v7.6.78
github.com/getlantern/fronted v0.0.0-20230601004823-7fec719639d8
github.com/getlantern/golog v0.0.0-20230503153817-8e72de7e0a65
github.com/getlantern/i18n v0.0.0-20181205222232-2afc4f49bb1c
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,8 @@ github.com/getlantern/fdcount v0.0.0-20210503151800-5decd65b3731/go.mod h1:XZwE+
github.com/getlantern/filepersist v0.0.0-20160317154340-c5f0cd24e799/go.mod h1:8DGAx0LNUfXNnEH+fXI0s3OCBA/351kZCiz/8YSK3i8=
github.com/getlantern/filepersist v0.0.0-20210901195658-ed29a1cb0b7c h1:mcz27xtAkb1OuOLBct/uFfL1p3XxAIcFct82GbT+UZM=
github.com/getlantern/filepersist v0.0.0-20210901195658-ed29a1cb0b7c/go.mod h1:8DGAx0LNUfXNnEH+fXI0s3OCBA/351kZCiz/8YSK3i8=
github.com/getlantern/flashlight/v7 v7.6.78-0.20240515232243-b037ce6b98a4 h1:WFi4cMuW4fuis7MnRrinDyHggkAhNhW2RGABAlt6QhQ=
github.com/getlantern/flashlight/v7 v7.6.78-0.20240515232243-b037ce6b98a4/go.mod h1:mCLryTjvsxvISCOay65kB0WLlKLF6fmKDOnA/RTo4bc=
github.com/getlantern/flashlight/v7 v7.6.78 h1:ADZ/ZJ/UoGQ6g6kGTzrecHt7P3PhOzPLRmsTc1lOzC0=
github.com/getlantern/flashlight/v7 v7.6.78/go.mod h1:GQtpdfigs9k+aoqSdxh2qTdRtAbktJSE5u1Sx3IsgW0=
github.com/getlantern/framed v0.0.0-20190601192238-ceb6431eeede h1:yrU6Px3ZkvCsDLPryPGi6FN+2iqFPq+JeCb7EFoDBhw=
github.com/getlantern/framed v0.0.0-20190601192238-ceb6431eeede/go.mod h1:nhnoiS6DE6zfe+BaCMU4YI01UpsuiXnDqM5S8jxHuuI=
github.com/getlantern/fronted v0.0.0-20230601004823-7fec719639d8 h1:r/Z/SPPIfLXDI3QA7/tE6nOfPncrqeUPDjiFjnNGP50=
Expand Down
14 changes: 0 additions & 14 deletions ios/Runner.xcworkspace/xcshareddata/swiftpm/Package.resolved

This file was deleted.

15 changes: 11 additions & 4 deletions lib/account/language.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:intl/intl.dart';
import 'package:lantern/common/common.dart';
import 'package:lantern/i18n/localization_constants.dart';
import 'package:sentry_flutter/sentry_flutter.dart';

@RoutePage<void>(name: 'Language')
class Language extends StatelessWidget {
Expand Down Expand Up @@ -30,14 +31,20 @@ class Language extends StatelessWidget {
),
value: lang,
groupValue: countryCode,
onChanged: (String? value) async {
await sessionModel.setLanguage(lang);
Navigator.pop(context);
},
onChanged: (newLocal) => onLocalChange(newLocal!,context)
);
},
);
}),
);
}

Future<void> onLocalChange(String newLocal, BuildContext context) async {
await sessionModel.setLanguage(newLocal);
Navigator.pop(context);
}




}
2 changes: 2 additions & 0 deletions lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ class _LanternAppState extends State<LanternApp> {
Locale('tr', 'TR'),
Locale('vi', 'VN'),
Locale('my', 'MM'),
Locale('hi', 'IN'),
Locale('bn', 'BD'),
],
),
),
Expand Down
6 changes: 3 additions & 3 deletions lib/i18n/i18n.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ extension Localization on String {

static String get localeShort => locale.split('_')[0];

String doLocalize() => localize(this, translations, locale: locale.replaceAll('_', '-'));
String doLocalize() => localize(this, translations, locale: locale);

String get i18n =>
localize(this, translations, locale: locale.replaceAll('_', '-'));
String get i18n => localize(this, translations, locale: locale.replaceFirst('_', '-').toLowerCase());
// String get i18n => localize(this, translations, locale: 'hi');

String fill(List<Object> params) => localizeFill(this, params);
}
1 change: 1 addition & 0 deletions lib/plans/plan_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ class PlanCard extends StatelessWidget {
isPro: isPro,
),
);
return;
} else if (isDesktop()) {
final paymentMethods = await sessionModel.paymentMethodsv4();
final providers = paymentProvidersFromMethods(paymentMethods);
Expand Down
5 changes: 0 additions & 5 deletions lib/plans/play_checkout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ class _PlayCheckoutState extends State<PlayCheckout>
: 'please_enter_a_valid_email_address'.i18n,
);

@override
void dispose() {
emailController.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
Expand Down
Loading

0 comments on commit d309c99

Please sign in to comment.