Skip to content

Commit

Permalink
Remove hardcoded strings and replace with translation keys
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrintt committed Jun 12, 2023
1 parent a5a6278 commit afefe19
Show file tree
Hide file tree
Showing 29 changed files with 765 additions and 157 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,23 @@ PlayStore link, add again when the new version is available.

There are several ways to contribute:

- To improve the translation: 1. open the `/i18n` folder, 2. create a file `app_<thelangcodeyouwanttoaddorimprove>.arb` and 3. translate the keys 4. then open a PR, that's it.
- To improve the translation:
1. Open the `/i18n` folder.
2. Create/edit a file `<the-lang-code-you-want-to-add-or-improve>.arb` (e.g `en.arb`).
3. Translate the keys.
4. Open a PR, that's it.
- To report a bug, create a new issue with an screenshot or a small description of the bug.
- To request a feature please add an issue to further discuss.

If you wanna contribute in private, you can also ping me on my email [[email protected]](mailto://[email protected]) to discuss any of the points above. Thanks in advance.

## Contributors

- Glad to have your work here [@WSTxda](https://linktr.ee/wstxda)! Thanks for your efforts on the [app icon](https://t.me/WSTprojects/1401), banner and the download badges.
- [Fantazzj](https://github.com/Fantazzj) added Italian language support.
- [@WSTxda](https://linktr.ee/wstxda) made the v0.4.0 app icon and provided support in the v0.5.0 icon.
- [IzzySoft](https://gitlab.com/IzzySoft) reported a issue with android version code [#13](https://github.com/alexrintt/kanade/issues/13) and added fastlane docs [#15](https://github.com/alexrintt/kanade/pull/15).

- I wanna thanks [IzzySoft](https://gitlab.com/IzzySoft) for taking time to point the [version code issue #13](https://github.com/alexrintt/kanade/issues/13), indexing this app to the [IzzyOnDroid app repository](https://gitlab.com/IzzyOnDroid/repo) and [helping with fastlane docs #15](https://github.com/alexrintt/kanade/pull/15), thanks man!
Thanks to all contributors!

## Credits

Expand Down
1 change: 1 addition & 0 deletions i18n/app_de.arb → i18n/de.arb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"@@locale": "de",
"settings": "Einstellungen",
"selectOutputFolder": "Ausgabeordner auswählen",
"notDefined": "Nicht definiert",
Expand Down
106 changes: 101 additions & 5 deletions i18n/app_en.arb → i18n/en.arb
Original file line number Diff line number Diff line change
@@ -1,5 +1,101 @@
{
"@@locale": "en",
"behaviorPreferences": "Behavior preferences",
"appearancePreferences": "Appearance preferences",
"donate": "Donate",
"links": "Links",
"openSourceLicenses": "Open source licenses",
"reportIssue": "Report issue",
"followMeOnGitHub": "Follow me on GitHub",
"githubRepository": "GitHub repository",
"packageAndVersion": "Package and version",
"overscrollIndicator": "Overscroll indicator",
"donateOnGitHub": "Donate on GitHub (Card)",
"donateOnKofi": "Ko-fi (Card or PayPal)",
"donateUsingPix": "Pix donation (Brazil only)",
"donateUsingBtc": "BTC donation",
"otherDonationMethods": "Other donation methods",
"unnamedPackage": "Unnamed package",
"version": "Version",
"unavailable": "Unavailable",
"user": "User",
"builtIn": "Built-in",
"system": "System",
"noResults": "No results!",
"cancelTask": "Cancel task",
"darkSimple": "Dark light",
"extractionIsNotFinishedCanNotInstallYet": "Not fully extracted yet, can not install right now",
"tasksAreAlreadyBeingDeleted": "These tasks were deleted and will be removed soon",
"loadingInfoEllipsis": "Loading info...",
"notAvailable": "Not available",
"openingFolderIsNotSupportedYet": "Opening a folder is not supported yet",
"confirmIrreversibleActionsExplanation": "Ask for confirmation whenever the user tries to do any irreversible action like deleting a file.",
"filterWillRemoveSomeSelectedItems": "This filter will erase some of your selected items, and you will need to re-select them again",
"hideAppBarOnScroll": "Hide app bar on scroll",
"extractWithSingleClick": "Extract with single click",
"confirmIrreversibleActions": "Ask for confirmation",
"displayUserInstalledApps": "Show user installed apps",
"displaySystemApps": "Show system apps",
"displayBuiltInApps": "Show built-in apps",
"transparentNavigationBar": "Translucent glass effect",
"hideAppBarOnScrollExplanation": "If enabled, the app bar will automatically hide when scroll down.",
"displaySystemAppsExplanation": "If enabled the home list will include system apps, they may not be launchable.",
"noActivityFoundThatCanHandleThisFileType": "There's no activity that can handle this file",
"displayBuiltInAppsExplanation": "If enabled the home list will include built-in apps, they are like system apps but openable.",
"displayUserInstalledAppsExplanation": "If enabled the home list will include apps installed by you.",
"transparentNavigationBarExplanation": "Apply a blur transparent effect to the home navigation bar.",
"trySelectingAtLeastOneFilter": "Try selecting at least one filter!",
"extractWithSingleClickExplanation": "If enabled, the app list will extract apk with a single click instead of opening the details page.",
"paymentMethodCard": "Card",
"settings": "Settings",
"goToAppList": "Go to app list",
"invalidApkItWasProbablyDeleted": "Invalid apk, is was probably deleted.",
"openFileLocation": "Open file location",
"resetAllPreferencesQuestion": "Reset all preferences?",
"exportApkExplanationMessage": "The apk list will appear here, to get start try to click over a tile on the app list screen! It will create a new export job that will copy the app apk to the folder you chose.",
"storagePermissionExplanationMessage": "To extract the apks this app needs access permission to a folder. It is recommended to select an empty folder or create a new one. It is also important to not select folders that are reserved by the system, such as the Android or Downloads folder.",
"notSet": "Not set",
"resetFolder": "Reset folder",
"launchApp": "Launch app",
"allFiles": "All files",
"exportApk": "Export apk",
"extracted": "Extracted",
"openOnPlayStore": "Open on Play Store",
"openOnFDroid": "Open on F-Droid",
"searchOnline": "Search online",
"remove": "Remove",
"deleteAllSelected": "Delete all selected",
"doYouWantToForceBulkDeleteAllTheseTasks": "Do you want force a bulk delete on all these tasks?",
"doYouWantToForceBulkCancelAllTheseTasks": "Do you want force a bulk cancel on all these tasks?",
"apps": "Apps",
"couldNotFindTargetFile": "We could not find the target file",
"couldNotFindFileLocationWithExplanation": "Could not find the file location this either was deleted or we have no permission over the folder.",
"soonEllipsis": "Soon...",
"soon": "Soon",
"loadingInfo": "Loading info",
"copiedToClipboard": "Copied to clipboard",
"invalidPackageUri": "Invalid package Uri",
"share": "Share",
"bouncing": "Bouncing",
"glow": "Glow",
"none": "None",
"areYouSure": "Are you sure?",
"delete": "Delete",
"shareApk": "Share apk",
"cancel": "Cancel",
"confirm": "Confirm",
"install": "Install",
"thisIsIrreversible": "This is a irreversible action, be sure you want to do it.",
"couldNotExtractWithExplanation": "Could not extract, this apk was probably uninstalled because we did not found it is apk file",
"installApk": "Install apk",
"extract": "Extract",
"successQueued": "Success! check \"Extracted\" tab",
"extractApk": "Extract apk",
"packageNameIsNotAvailable": "Package name is not available",
"copyPackageName": "Copy package name",
"packageIdIsNotAvailable": "Package ID is not available",
"copyPackageId": "Copy package ID",
"uninstall": "Uninstall",
"@settings": {
"description": "Label for the settings page."
},
Expand All @@ -21,7 +117,7 @@
},
"ofN": "of",
"@ofN": {
"description": "String to be used as preposition."
"description": "String to be used as preposition, e.g: Showing 10 results of 1000."
},
"extractAllSelected": "Extract all selected",
"@extractAllSelected": {
Expand Down Expand Up @@ -103,12 +199,12 @@
"@followTheSystem": {
"description": "One of the available themes representing a theme that follows the device/system theme."
},
"darkHacker": "Dark hacker",
"@darkHacker": {
"greenDark": "Dark hacker",
"@greenDark": {
"description": "One of the available themes representing a dark lights out with green as primary color."
},
"darkBlood": "Dark blood",
"@darkBlood": {
"redDark": "Red dark",
"@redDark": {
"description": "One of the available themes representing a dark lights out with red as primary color."
},
"someApkWereNotExtracted": "Some apks are located in {apkLocation} but some could not be extracted",
Expand Down
1 change: 1 addition & 0 deletions i18n/app_es.arb → i18n/es.arb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"@@locale": "es",
"settings": "Configuraciones",
"selectOutputFolder": "Seleccionar carpeta de salida",
"notDefined": "No definido",
Expand Down
1 change: 1 addition & 0 deletions i18n/app_it.arb → i18n/it.arb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"@@locale": "it",
"settings": "Impostazioni",
"selectOutputFolder": "Seleziona cartella di output",
"notDefined": "Non definita",
Expand Down
1 change: 1 addition & 0 deletions i18n/app_ja.arb → i18n/ja.arb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"@@locale": "ja",
"settings": "設定",
"selectOutputFolder": "出力フォルダを選択",
"notDefined": "定義されていません",
Expand Down
1 change: 1 addition & 0 deletions i18n/app_pt.arb → i18n/pt.arb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"@@locale": "pt",
"settings": "Configurações",
"selectOutputFolder": "Selecionar a pasta de saída",
"notDefined": "Não definido",
Expand Down
2 changes: 1 addition & 1 deletion l10n.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
arb-dir: ./i18n
template-arb-file: app_en.arb
template-arb-file: en.arb
output-localization-file: app_localizations.dart
untranslated-messages-file: missing-translations.txt
32 changes: 16 additions & 16 deletions lib/pages/settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class _SettingsPageState extends State<SettingsPage>
onTap: () async {
final bool confirmed = await showConfirmationModal(
context: context,
message: 'Reset all preferences?',
message: context.strings.resetAllPreferencesQuestion,
);

if (confirmed) {
Expand All @@ -96,25 +96,25 @@ class _SettingsPageState extends State<SettingsPage>
const AppFontFamilySettingsTile(),
const AppLocalizationSettingsTile(),
const HorizontalRule(),
const SettingsTileTitle('Behavior preferences'),
SettingsTileTitle(context.strings.behaviorPreferences),
AppBooleanPreferencesSettingsTile(
values: SettingsBoolPreference.filterBy(
category: SettingsBoolPreferenceCategory.behavior,
),
),
const HorizontalRule(),
const SettingsTileTitle('Appearance preferences'),
SettingsTileTitle(context.strings.appearancePreferences),
const AppOverscrollPhysicsTile(),
AppBooleanPreferencesSettingsTile(
values: SettingsBoolPreference.filterBy(
category: SettingsBoolPreferenceCategory.appearance,
),
),
const HorizontalRule(),
const SettingsTileTitle('Donate'),
SettingsTileTitle(context.strings.donate),
const DonationSettingsTile(),
const HorizontalRule(),
const SettingsTileTitle('Links'),
SettingsTileTitle(context.strings.links),
const RelatedLinks(),
const HorizontalRule(),
const Padding(
Expand Down Expand Up @@ -170,25 +170,25 @@ class _RelatedLinksState extends State<RelatedLinks>
mainAxisSize: MainAxisSize.min,
children: <Widget>[
buildTile(
title: 'Open source licenses',
title: context.strings.openSourceLicenses,
onTap: () => showLicensePage(context: context),
),
buildTile(
title: 'Report a issue',
title: context.strings.reportIssue,
onTap: openThisLink('https://github.com/alexrintt/kanade/issues'),
),
buildTile(
title: 'Follow me on GitHub',
title: context.strings.followMeOnGitHub,
onTap: openThisLink('https://github.com/alexrintt'),
description: '@alexrintt',
),
buildTile(
title: 'GitHub repository',
title: context.strings.githubRepository,
onTap: openThisLink('https://github.com/alexrintt/kanade'),
description: 'github.com/alexrintt/kanade',
),
buildTile(
title: 'Package and version',
title: context.strings.packageAndVersion,
onTap: copyThisText(_packageVersion),
description: _packageVersion,
),
Expand Down Expand Up @@ -333,7 +333,7 @@ class _AppOverscrollPhysicsTileState extends State<AppOverscrollPhysicsTile>
horizontal: k10dp,
),
enableFeedback: true,
title: const Text('Overscroll indicator'),
title: Text(context.strings.overscrollIndicator),
subtitle: AnimatedBuilder(
animation: themeStore,
builder: (BuildContext context, Widget? child) {
Expand Down Expand Up @@ -514,28 +514,28 @@ class _DonationSettingsTileState extends State<DonationSettingsTile>
mainAxisSize: MainAxisSize.min,
children: <Widget>[
buildTile(
title: 'Donate on GitHub (Card)',
title: context.strings.donateOnGitHub,
onTap: openThisLink(_githubSponsor.toString()),
description: _githubSponsor.host + _githubSponsor.path,
),
buildTile(
title: 'Ko-fi (Card or PayPal)',
title: context.strings.donateOnKofi,
onTap: openThisLink(_kofi.toString()),
description: _kofi.host + _kofi.path,
),
buildTile(
title: 'Pix donation (Brazil only)',
title: context.strings.donateUsingPix,
onTap: openThisLink(_livePix.toString()),
description: _livePix.host + _livePix.path,
),
buildTile(
title: 'BTC donation',
title: context.strings.donateUsingBtc,
onLongPress: copyThisText(_btcAddress),
onTap: copyThisText(_btcAddress),
description: _btcAddress,
),
buildTile(
title: 'Other donation methods',
title: context.strings.otherDonationMethods,
onTap: openThisLink('https://donate.alexrintt.io'),
description: 'donate.alexrintt.io',
),
Expand Down
23 changes: 13 additions & 10 deletions lib/screens/app_list_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import '../stores/contextual_menu_store.dart';
import '../stores/device_apps_store.dart';
import '../stores/settings_store.dart';
import '../stores/theme_store.dart';
import '../utils/app_localization_strings.dart';
import '../utils/context_confirm.dart';
import '../utils/context_of.dart';
import '../utils/context_show_apk_result_message.dart';
Expand Down Expand Up @@ -210,7 +211,7 @@ class _MainAppListState extends State<MainAppList>
builder: (_) => InstalledAppMenuOptions(
iconBytes: package.icon,
packageId: package.id,
title: package.name ?? package.id ?? 'Unnamed package',
title: package.name ?? package.id ?? context.strings.unnamedPackage,
subtitle: _generatePackageSubtitle(package),
packageInstallerFile:
package.installerPath != null ? File(package.installerPath!) : null,
Expand Down Expand Up @@ -266,8 +267,7 @@ class _MainAppListState extends State<MainAppList>
final bool confirmed = await showConfirmationModal(
context: context,
force: true,
message:
'This filter will erase some of your selected items, and you will need to re-select them again',
message: context.strings.filterWillRemoveSomeSelectedItems,
);

if (!confirmed) return;
Expand All @@ -290,7 +290,9 @@ class _MainAppListState extends State<MainAppList>
if (package.versionName != null) {
final String before = subtitle.isNotEmpty ? ' (' : '';
final String after = subtitle.isNotEmpty ? ')' : '';
subtitle.write('${before}Version: ${package.versionName}$after');
subtitle.write(
'$before${context.strings.version}: ${package.versionName}$after',
);
}

if (subtitle.isEmpty && package.name != null) {
Expand All @@ -301,7 +303,7 @@ class _MainAppListState extends State<MainAppList>
return subtitle.toString();
}

return 'Unavailable';
return context.strings.unavailable;
}

Widget _buildFilterChips() {
Expand Down Expand Up @@ -330,15 +332,15 @@ class _MainAppListState extends State<MainAppList>
),
),
_buildInstalledAppsFilterChip(
'User',
context.strings.user,
SettingsBoolPreference.displayUserInstalledApps,
),
_buildInstalledAppsFilterChip(
'Built-in',
context.strings.builtIn,
SettingsBoolPreference.displayBuiltInApps,
),
_buildInstalledAppsFilterChip(
'System',
context.strings.system,
SettingsBoolPreference.displaySystemApps,
),
],
Expand Down Expand Up @@ -419,8 +421,9 @@ class _MainAppListState extends State<MainAppList>
padding: const EdgeInsets.all(k8dp),
child: LooksEmptyHere(
message: store.isSearchMode
? 'No results!'
: 'Try selecting at least one filter!',
? context.strings.noResults
: context
.strings.trySelectingAtLeastOneFilter,
),
),
Padding(
Expand Down
Loading

0 comments on commit afefe19

Please sign in to comment.