Skip to content

Commit

Permalink
Merge pull request #5 from mo-ah-dawood/master
Browse files Browse the repository at this point in the history
Add arguments to translate method
  • Loading branch information
msayed-net committed May 12, 2020
2 parents 2f9f30a + 54c82f4 commit 1cdd24f
Show file tree
Hide file tree
Showing 19 changed files with 16 additions and 215 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
.pub/

build/
pubspec.lock
example/pubspec.lock
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Flutter Localization In Human Way
| ------------- |:-------------:|
| `init()` |initialize things, before runApp() |
| `translate('word')` |word translation |
| `translate('word',{"key":"value"})` |word translation with replacement arguments|
| `googleTranslate('word', from: 'en', to: 'ar')` |google translate |
| `setNewLanguage(context,newLanguage:'en',restart: true, remember: true,)` |change language |
| `isDirectionRTL()` |is Direction RTL check |
Expand Down
8 changes: 0 additions & 8 deletions android/.gitignore

This file was deleted.

44 changes: 0 additions & 44 deletions android/build.gradle

This file was deleted.

4 changes: 0 additions & 4 deletions android/gradle.properties

This file was deleted.

5 changes: 0 additions & 5 deletions android/gradle/wrapper/gradle-wrapper.properties

This file was deleted.

1 change: 0 additions & 1 deletion android/settings.gradle

This file was deleted.

3 changes: 0 additions & 3 deletions android/src/main/AndroidManifest.xml

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ packages:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.11"
version: "1.14.12"
cupertino_icons:
dependency: "direct main"
description:
Expand Down Expand Up @@ -64,7 +64,7 @@ packages:
name: intl
url: "https://pub.dartlang.org"
source: hosted
version: "0.16.0"
version: "0.16.1"
localize_and_translate:
dependency: "direct main"
description:
Expand Down
37 changes: 0 additions & 37 deletions ios/.gitignore

This file was deleted.

Empty file removed ios/Assets/.gitkeep
Empty file.
4 changes: 0 additions & 4 deletions ios/Classes/LocalizeAndTranslatePlugin.h

This file was deleted.

15 changes: 0 additions & 15 deletions ios/Classes/LocalizeAndTranslatePlugin.m

This file was deleted.

14 changes: 0 additions & 14 deletions ios/Classes/SwiftLocalizeAndTranslatePlugin.swift

This file was deleted.

23 changes: 0 additions & 23 deletions ios/localize_and_translate.podspec

This file was deleted.

12 changes: 8 additions & 4 deletions lib/localize_and_translate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,14 @@ class LocalizeAndTranslate {
///------------------------------------------------
/// Transle : [key]
///------------------------------------------------
String translate(String key) {
return (_values == null || _values[key] == null)
? '$key'
: _values[key];
String translate(String key, [Map<String, String> arguments]) {
String value =
(_values == null || _values[key] == null) ? '$key' : _values[key];
if (arguments == null) return value;
for (var key in arguments.keys) {
value = value.replaceAll(key, arguments[key]);
}
return value;
}

///------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ packages:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.11"
version: "1.14.12"
flutter:
dependency: "direct main"
description: flutter
Expand Down Expand Up @@ -57,7 +57,7 @@ packages:
name: intl
url: "https://pub.dartlang.org"
source: hosted
version: "0.16.0"
version: "0.16.1"
meta:
dependency: transitive
description:
Expand Down
5 changes: 1 addition & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,4 @@ dependencies:
intl: ^0.16.0
translator: ^0.1.4

flutter:
plugin:
androidPackage: net.msayed.localize_and_translate
pluginClass: LocalizeAndTranslatePlugin

0 comments on commit 1cdd24f

Please sign in to comment.