Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(deriv_localizations): [MOBC-669] Added the localizations package. #370

Merged
merged 20 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
bd9feb1
feat(`deriv_localizations`): added the package
bassam-deriv Dec 14, 2023
7978004
feat(deriv_localizations): refactored packages and added required loc…
bassam-deriv Dec 19, 2023
94cb025
feat(deriv_localizations): added localization generation bash script
bassam-deriv Dec 19, 2023
7598a58
feat(deriv_localizations): added `crowdin` configuration file
bassam-deriv Dec 19, 2023
141f426
feat(deriv_localizations): added `Localization Update` github actions…
bassam-deriv Dec 19, 2023
bc23411
chore(deriv_localizations): changed sdk version
bassam-deriv Dec 21, 2023
c8fe83b
chore(deriv_localizations): added EOF to files
bassam-deriv Dec 21, 2023
df51ce9
refactor(deriv_localizations): removed unnecessary `workflow_dispatch`
bassam-deriv Dec 21, 2023
330733b
refactor(deriv_localizations): changed `GITHUB_TOKEN` to `PAT`
bassam-deriv Dec 21, 2023
f231fb8
chore(deriv_localizations): fixed automated PR title
bassam-deriv Dec 21, 2023
a0b5aee
refactor(deriv_localizations): changed email and username for localiz…
bassam-deriv Dec 21, 2023
a4a8540
refactor(deriv_localizations): removed unsused permissions in workflo…
bassam-deriv Dec 22, 2023
968cf6e
refactor(deriv_localizations): Update .github/workflows/localization.yml
bassam-deriv Dec 22, 2023
c4edb27
refactor(deriv_localizations): replaced tag with commit hash in local…
bassam-deriv Dec 22, 2023
5a656e6
Merge branch 'deriv_localizations' of https://github.com/bassam-deriv…
bassam-deriv Dec 22, 2023
3c30242
doc(deriv_localizations): added README.md content for package
bassam-deriv Dec 22, 2023
dfacb26
Merge branch 'master' into deriv_localizations
bassam-deriv Dec 26, 2023
df68321
chore(deriv_localizations): added custom PR title in crowdin config
bassam-deriv Dec 28, 2023
c210130
refactor(deriv_paskeys): changed localization PR to `refactor`
bassam-deriv Jan 2, 2024
e4384a7
Merge branch 'master' into deriv_localizations
bassam-deriv Jan 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/localization.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Localization Update

on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
tags:
description: 'Test scenario tags'
required: false
type: boolean
environment:
description: 'Environment to run tests against'
type: environment
required: false
bassam-deriv marked this conversation as resolved.
Show resolved Hide resolved
pull_request:
branches:
- master
types: [closed]

jobs:
update-localizations:
defaults:
run:
working-directory: ./packages/deriv_localizations
if: github.event.pull_request.merged == true && github.event.pull_request.head.ref == 'l10n_master'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
bassam-deriv marked this conversation as resolved.
Show resolved Hide resolved
steps:
- name: Check out the repository
uses: actions/checkout@v4
bassam-deriv marked this conversation as resolved.
Show resolved Hide resolved

- name: Setup Flutter
uses: subosito/flutter-action@v2
bassam-deriv marked this conversation as resolved.
Show resolved Hide resolved
with:
channel: "stable"
flutter-version: "3.10.2"
cache: true

- name: Setup Config
run: |
git config --global user.name 'bassam-deriv'
git config --global user.email '[email protected]'
bassam-deriv marked this conversation as resolved.
Show resolved Hide resolved

- name: Make the script files executable
run: chmod +x l10n.sh
- name: Run the scripts
run: |
./l10n.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


- name: Create Pull Request.
uses: peter-evans/create-pull-request@v5
bassam-deriv marked this conversation as resolved.
Show resolved Hide resolved
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: "chore(version): Crowdin Localization Generated"
base: master
bassam-deriv marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions crowdin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
files:
- source: /packages/deriv_localizations/lib/l10n/**/app_en.arb
translation: /packages/deriv_localizations/lib/l10n/**/app_%two_letters_code%.arb
44 changes: 44 additions & 0 deletions packages/deriv_localizations/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
45 changes: 45 additions & 0 deletions packages/deriv_localizations/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: "ead455963c12b453cdb2358cad34969c76daf180"
channel: "stable"

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: ead455963c12b453cdb2358cad34969c76daf180
base_revision: ead455963c12b453cdb2358cad34969c76daf180
- platform: android
create_revision: ead455963c12b453cdb2358cad34969c76daf180
base_revision: ead455963c12b453cdb2358cad34969c76daf180
- platform: ios
create_revision: ead455963c12b453cdb2358cad34969c76daf180
base_revision: ead455963c12b453cdb2358cad34969c76daf180
- platform: linux
create_revision: ead455963c12b453cdb2358cad34969c76daf180
base_revision: ead455963c12b453cdb2358cad34969c76daf180
- platform: macos
create_revision: ead455963c12b453cdb2358cad34969c76daf180
base_revision: ead455963c12b453cdb2358cad34969c76daf180
- platform: web
create_revision: ead455963c12b453cdb2358cad34969c76daf180
base_revision: ead455963c12b453cdb2358cad34969c76daf180
- platform: windows
create_revision: ead455963c12b453cdb2358cad34969c76daf180
base_revision: ead455963c12b453cdb2358cad34969c76daf180

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
5 changes: 5 additions & 0 deletions packages/deriv_localizations/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# deriv_localizations

This package contains the localization arb and dart generated files for flutter_deriv_packages.

## Usage
28 changes: 28 additions & 0 deletions packages/deriv_localizations/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at https://dart.dev/lints.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
42 changes: 42 additions & 0 deletions packages/deriv_localizations/l10n.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash


# Directories containing ARB files
feature_dirs=("deriv_auth")

# Base localization directory
base_l10n_dir="lib/l10n"

# Function to convert snake_case to PascalCase
snake_to_pascal() {
echo "$1" | awk 'BEGIN{FS=OFS="_"} {for(i=1; i<=NF; i++) $i=toupper(substr($i,1,1)) substr($i,2)} 1' | sed 's/_//g'
}

for dir in "${feature_dirs[@]}"; do
arb_dir="$base_l10n_dir/$dir"
output_dir="$base_l10n_dir/generated/$dir"
output_file="${dir}_localizations.dart"
output_class="$(snake_to_pascal $dir)Localizations"

# Execute the command
flutter gen-l10n \
--arb-dir="$arb_dir" \
--output-localization-file="$output_file" \
--output-class="$output_class" \
--output-dir="$output_dir" \
--no-synthetic-package
done

ls $base_l10n_dir/generated

echo "Localization generation complete."


# Add the generated localization files to Git
git add "$base_l10n_dir/generated"

# Commit the changes
git commit -m "Update localizations"


echo "Localization generation complete."
116 changes: 116 additions & 0 deletions packages/deriv_localizations/lib/l10n/deriv_auth/app_en.arb
bassam-deriv marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{
"labelNotAvailable": "Not available",
"warnNotAvailableCountriesTitle": "{app} isn't available in your country",
"@warnNotAvailableCountriesTitle": {
"description": "A message with a single parameter",
"placeholders": {
"app": {
"type": "String",
"example": "Deriv GO"
}
}
},
"actionOk": "OK",
"warnNotAvailableCountries": "If you have any questions, contact us via ",
"labelLiveChat": "Live chat",
"actionGetAFreeAccount": "Get a free account",
"actionLogin": "Log in",
"labelTwoFactorAuth": "Two-factor authentication",
"informEnterTwoFactorAuthCode": "Enter the 6-digit code from the authenticator app on your phone.",
"labelTwoFactorAuthenticationCode": "2FA code",
"actionProceed": "Proceed",
"labelLogIn": "Log in",
"informLoginOptions": "Or log in with",
"labelEmail": "Email",
"labelPassword": "Password",
"actionForgotPassword": "Forgot password?",
"labelDontHaveAnAccountYet": "Don’t have an account yet?",
"actionCreateANewAccount": "Create a new account",
"informInvalidEmailFormat": "Enter a valid email address",
"warnPasswordLength": "You should enter 8-25 characters.",
"labelResetPassword": "Reset Password",
"labelChooseNewPass": "Choose a new password",
"labelCreatePass": "Create a password",
"informYourPassHasBeenReset": "Your password has been reset",
"informRedirectLogin": "You’ll need to log in with your new password. Hang on, we’re redirecting you.",
"actionResetPass": "Reset my password",
"informInvalidPasswordFormat": "Please enter a valid password format",
"labelCheckEmail": "Check your email",
"informSendResetPasswordEmail": "We’ve sent a message to {email} with a link to reset your password.",
"@informSendResetPasswordEmail": {
"description": "A message with a single parameter",
"placeholders": {
"email": {
"type": "String",
"example": "[email protected]"
}
}
},
"informResetPassByEmail": "We'll email you instructions to reset your password.",
"labelSelectCountry": "Where do you live?",
"labelChooseCountry": "Choose country",
"warnCountryNotAvailable": "Unfortunately, Deriv is not available in your country.",
"actionNext": "Next",
"labelEmailIssueHeader": "If you don't see an email from us within a few minutes, a few things could have happened:",
"labelEmailIssueSpam": "The email is in your spam folder (Sometimes things get lost there).",
"labelEmailIssueWrongEmail": "You accidentally gave us another email address (Usually a work or a personal one instead of the one you meant).",
"labelEmailIssueTypo": "The email address you entered had a mistake or typo (happens to the best of us).",
"labelEmailIssueFirewall": "We can't deliver the email to this address (Usually because of firewalls or filtering).",
"actionReenterEmail": "Re-enter your email and try again",
"labelKeepPassword": "Keep your account secure with a password",
"labelCreatePassword": "Create a password",
"actionStartTrading": "Start trading",
"actionPrevious": "Previous",
"labelSignUp": "Sign up",
"labelOrSignUpWith": "Or sign up with",
"labelReferralInfoTitle": "Affiliate referral code",
"infoReferralInfoDescription": "An alphanumeric code provided by a Deriv affiliate, applicable for email sign-ups only.",
"labelGotReferralCode": "Got a referral code?",
"labelHaveAccount": "Already have an account?",
"actionCreateAccount": "Create free demo account",
"informInvalidReferralCode": "The referral code you entered is invalid. Check and try again.",
"labelVerifyYourEmail": "Verify your email",
"labelThanksEmail": "Thanks for verifying your email",
"informLetsContinue": "Let's continue.",
"actionContinue": "Continue",
"labelSearchCountry": "Search country",
"informVerificationEmailSent": "We've sent a message to {email} with a link to activate your account.",
"@informVerificationEmailSent": {
"description": "A message with a single parameter",
"placeholders": {
"email": {
"type": "String",
"example": "[email protected]"
}
}
},
"actionEmailNotReceived": "Didn't receive your email?",
"informPasswordPolicy": "Your password must have:",
"informPasswordPolicyLength": "8-25 characters",
"informPasswordPolicyLowerAndUpper": "Upper and lower case letters",
"informPasswordPolicyNumber": "At least one number",
"warnPasswordContainsSymbol": "Use symbols for strong password.",
"labelReferralCode": "Referral Code",
"actionTryAgain": "Try Again",
"informInvalid2FACode": "The code you entered is invalid. Check and try again.",
"informFailedAuthentication": "Your email or password may be incorrect. Did you sign up with a social account? Check and try again.",
"informDeactivatedAccount": "Your account is deactivated.",
"informFailedAuthorization": "Authorization failed.",
"informInvalidResidence": "Invalid residence.",
"informInvalidCredentials": "Invalid credentials.",
"informMissingOtp": "Missing one-time password.",
"informSelfClosed": "Your account has been closed.",
"informUnexpectedError": "An unexpected error occurred.",
"informUnsupportedCountry": "Your country is not supported.",
"informExpiredAccount": "Your account is expired",
"labelCountryConsentBrazil": "I hereby confirm that my request for opening an account with Deriv to trade OTC products issued and offered exclusively outside Brazil was initiated by me. I fully understand that Deriv is not regulated by CVM and by approaching Deriv I intend to set up a relation with a foreign company.",
"informConnectionError": "Connection error. Please try again later.",
"informSwitchAccountError": "Switch account error. Please try again later.",
"labelDeveloper": "Developer",
"labelEndpoint": "Endpoint",
"semanticEndpoint": "Endpoint",
"warnInvalidEndpoint": "invalid endpoint",
"labelApplicationID": "Application ID",
"semanticApplicationID": "Application ID",
"warnInvalidApplicationID": "invalid application ID"
}
34 changes: 34 additions & 0 deletions packages/deriv_localizations/pubspec.yaml
bassam-deriv marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: deriv_localizations
description: This packages contains all localizations for the deriv packages

publish_to: 'none'

version: 1.0.0+1

environment:
sdk: '>=3.0.2 <4.0.0'


dependencies:
flutter:
sdk: flutter

flutter_localizations:
sdk: flutter
intl: ^0.19.0



cupertino_icons: ^1.0.2

dev_dependencies:
flutter_test:
sdk: flutter


flutter_lints: ^2.0.0


flutter:
uses-material-design: true
generate: true
Loading