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

added support for flutter 'lib\' dir #700

Closed

Conversation

harrowmykel
Copy link

  • This pull request adds support for flutter 'lib/' directory

  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.

@mosuem
Copy link
Member

mosuem commented Aug 21, 2023

I would like to keep the intl_translation package independent of Flutter implementation details, what are you trying to achieve exactly which can't be fixed with the current setup?

@harrowmykel
Copy link
Author

harrowmykel commented Aug 21, 2023 via email

@mosuem
Copy link
Member

mosuem commented Aug 22, 2023

This is already now possible using glob syntax, see the readme. Or am I missing something?

@harrowmykel
Copy link
Author

harrowmykel commented Aug 22, 2023 via email

@mosuem
Copy link
Member

mosuem commented Aug 23, 2023

The glob syntax is a bash feature, so for example using dart run bin/extract_to_arb.dart $(find example/ -name '*.dart') in the intl_translation root does do the trick. I agree however that an option to specify the folders directly seems a lot more convenient.

@@ -1,3 +1,6 @@
## 0.19.1-dev
* Added support for Flutter `lib/` folder.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove references to Flutter

@@ -18,6 +18,15 @@ dart run intl_translation:extract_to_arb --output-dir=target/directory \
my_program.dart more_of_my_program.dart
```

This support passing a folder directory to it that contains `.dart` files. The code will automatically extract all `.dart` files
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This support passing a folder directory to it that contains `.dart` files. The code will automatically extract all `.dart` files
This supports passing a folder directory that contains `.dart` files. The code will automatically extract all `.dart` files

@@ -18,6 +18,15 @@ dart run intl_translation:extract_to_arb --output-dir=target/directory \
my_program.dart more_of_my_program.dart
```

This support passing a folder directory to it that contains `.dart` files. The code will automatically extract all `.dart` files
in the folder AND its subfolders as well. This means it can be used for flutter `lib/` folder as well.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
in the folder AND its subfolders as well. This means it can be used for flutter `lib/` folder as well.
in the folder and its subfolders.

@@ -99,6 +102,11 @@ void main(List<String> args) {
help: "Fail for messages that don't have a description.",
callback: (val) => extract.descriptionRequired = val,
);
parser.addOption(
'lib-dir',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about a more general name, such as input or similar?

@@ -30,3 +30,51 @@ String _relativeToBase(String base, String filename) {
return filename;
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about a simpler

Directory(pathGivenByUser)
      .listSync(recursive: true)
      .whereType<File>()
      .where((element) => element.path.endsWith('.dart'))
      .toList()

This would even by synchronous.

///by adding cache functionality as well as helper
///methods to FileSystemEntity

class FFileSystemEntity {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be unnecessary with the change above.

@@ -1,5 +1,5 @@
name: intl_translation
version: 0.19.0-dev
version: 0.19.1-dev
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just leave it at 0.19.0-dev while this package is not published.

@github-actions
Copy link

PR Health

Package publish validation ✔️

Details
Package Version Status
package:intl 0.19.0-dev pre-release version (no publish necessary)
package:intl4x 0.5.0 already published at pub.dev
package:intl_translation 0.19.1-dev pre-release version (no publish necessary)

Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.

License Headers ✔️

Details
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files
no missing headers

All source files should start with a license header.

Unrelated files missing license headers
Files
pkgs/intl/lib/src/global_state.dart
pkgs/intl/lib/locale.dart
pkgs/intl/lib/find_locale.dart
pkgs/intl/test/number_format_compact_icu_test.dart
pkgs/intl/test/number_format_compact_web_test.dart
pkgs/intl_translation/test/two_components/app_messages_all.dart
pkgs/intl_translation/test/two_components/app_messages_all_locales.dart
pkgs/intl_translation/test/two_components/component_messages_fr_xyz123.dart
pkgs/intl_translation/test/two_components/app_messages_fr.dart
pkgs/intl_translation/test/two_components/component_messages_all_locales.dart
pkgs/intl_translation/test/two_components/component_messages_all.dart
pkgs/intl_translation/test/generate_localized/code_map_messages_all.dart
pkgs/intl_translation/test/generate_localized/code_map_messages_all_locales.dart
pkgs/intl_translation/test/generate_localized/code_map_messages_fr.dart
pkgs/intl_translation/example/lib/generated/messages_iw.dart
pkgs/intl_translation/example/lib/generated/messages_de.dart
pkgs/intl_translation/example/lib/generated/messages_all_locales.dart
pkgs/intl_translation/example/lib/generated/messages_en.dart
pkgs/intl_translation/example/lib/generated/messages_all.dart
pkgs/intl_translation/example/lib/generated/messages_de_CH.dart
pkgs/intl_translation/example/lib/generated/messages_es.dart

Changelog Entry ✔️

Details
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

Coverage ⚠️

Details
File Coverage
pkgs/intl_translation/bin/extract_to_arb.dart 💔 Not covered
pkgs/intl_translation/lib/src/directory_utils.dart 💔 Not covered
pkgs/intl_translation/lib/src/ffile_system_entity.dart 💔 Not covered

This check for test coverage is informational (issues shown here will not fail the PR).

This check can be disabled by tagging the PR with skip-coverage-check

@mosuem mosuem added the needs-info Additional information needed from the issue author label Sep 15, 2023
@mosuem
Copy link
Member

mosuem commented Jul 29, 2024

Closing as there is no activity.

@mosuem mosuem closed this Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-info Additional information needed from the issue author package:intl_translation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants