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

Add greek translations for Measurement provider & other Greek tests #1410

Merged
merged 7 commits into from
Oct 27, 2024

Conversation

gvrettos
Copy link
Contributor

Some more translations, for Measurement provider this time.

Could you please annotate this PR with hacktoberfest-accepted label?

Copy link

what-the-diff bot commented Oct 27, 2024

PR Summary

  • Removed an unnecessary gap in the Greek translations, enhancing the tidiness of the code.
  • Introduced a 'Measurement' section in Greek to widen our localisation coverage:
    • Added translations for different units of Height: Inches and Feet.
    • Introduced Greek translations for units of Length: Yards, Feet, and Miles.
    • Expanded the Volume section with the inclusion of the Cup, Tablespoon, Teaspoon, Quart, Pint, Gallon, and Fluid Ounce.
    • Included Greek translations for Weight parameters: Pound, Ounce, and Ton.
    • Incorporated the Metric system:
      • Metric Height units: Centimeter and Meter.
      • Metric Length units: Millimeter, Centimeter, Decameter, Meter, Decameter, Hectometer and Kilometer.
      • Metric Volume units: Milliliter and Liter.
      • Metric Weight units: Milligram, Gram, Decagram, Gram, Decagram, Hectogram, Kilogram and Metric Ton.

These modifications serve to enhance user experience by catering to the needs of our Greek-speaking customers, especially in sectors where conversion between units is a frequent necessity.

Copy link
Collaborator

@kingthorin kingthorin left a comment

Choose a reason for hiding this comment

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

Could you add tests?

Copy link

codecov bot commented Oct 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.25%. Comparing base (0f09cee) to head (054a8b7).
Report is 8 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1410      +/-   ##
============================================
+ Coverage     92.21%   92.25%   +0.04%     
- Complexity     3149     3151       +2     
============================================
  Files           319      319              
  Lines          6149     6149              
  Branches        591      591              
============================================
+ Hits           5670     5673       +3     
+ Misses          334      333       -1     
+ Partials        145      143       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bodiam
Copy link
Contributor

bodiam commented Oct 27, 2024

Hi @gvrettos , thank you for your contribution. Feel free to send them, but we won't be applying hacktoberfest labels to your PRs anymore. Thank you.

@gvrettos
Copy link
Contributor Author

gvrettos commented Oct 27, 2024

Could you add tests?

Hi @kingthorin!
Do you have something specific in mind? MeasurementTest and FakerIntegrationTest seem relevant but I could not find something that needs updating. Do I miss something?

Hi @gvrettos , thank you for your contribution. Feel free to send them, but we won't be applying hacktoberfest labels to your PRs anymore. Thank you.

Hi @bodiam! I am sorry if that got too frustrating for you. ☹️
Could you please let me know what is the reason for not applying the hacktoberfest label? I would like to know if I have done something wrong here.

@kingthorin
Copy link
Collaborator

kingthorin commented Oct 27, 2024

How about something like this?

Suggested test changes (diff)
diff --git a/src/test/java/net/datafaker/providers/base/BaseFakerTest.java b/src/test/java/net/datafaker/providers/base/BaseFakerTest.java
index 4f4a16d8..030045fd 100644
--- a/src/test/java/net/datafaker/providers/base/BaseFakerTest.java
+++ b/src/test/java/net/datafaker/providers/base/BaseFakerTest.java
@@ -22,7 +22,7 @@
 public class BaseFakerTest<T extends BaseFaker> {

     private static final Logger LOG = Logger.getLogger(BaseFakerTest.class.getCanonicalName());
-    protected final T faker = getFaker();
+    protected T faker = getFaker();

     @BeforeEach
     @SuppressWarnings("EmptyTryBlock")
@@ -38,6 +38,10 @@ protected T getFaker() {
         return (T) new BaseFaker();
     }

+    protected void setFaker(T faker) {
+        this.faker = (T) faker;
+    }
+
     protected List<String> getBaseList(String key) {
         return faker.fakeValuesService().fetchObject(key, faker.getContext());
     }
diff --git a/src/test/java/net/datafaker/providers/base/MeasurementTest.java b/src/test/java/net/datafaker/providers/base/MeasurementTest.java
index 6c759c66..e88239d0 100644
--- a/src/test/java/net/datafaker/providers/base/MeasurementTest.java
+++ b/src/test/java/net/datafaker/providers/base/MeasurementTest.java
@@ -1,6 +1,12 @@
 package net.datafaker.providers.base;

 import java.util.List;
+import java.util.Locale;
+
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Nested;
+
 import java.util.Collection;

 class MeasurementTest extends BaseFakerTest<BaseFaker> {
@@ -19,4 +25,32 @@ protected Collection<TestSpec> providerListTest() {
             TestSpec.of(measurement::metricVolume, "measurement.metric_volume"),
             TestSpec.of(measurement::metricWeight, "measurement.metric_weight"));
     }
+
+    @Nested
+    class GreekMeasurementTest extends BaseFakerTest<BaseFaker> {
+
+        @BeforeAll
+        void setup() {
+            this.setFaker(new BaseFaker(new Locale("el", "GR")));
+        }
+
+        @AfterAll
+        void reset() {
+            this.setFaker(this.getFaker());
+        }
+
+        @Override
+        protected Collection<TestSpec> providerListTest() {
+
+            Measurement measurement = faker.measurement();
+            return List.of(TestSpec.of(measurement::height, "measurement.height"),
+                TestSpec.of(measurement::length, "measurement.length"),
+                TestSpec.of(measurement::volume, "measurement.volume"),
+                TestSpec.of(measurement::weight, "measurement.weight"),
+                TestSpec.of(measurement::metricLength, "measurement.metric_length"),
+                TestSpec.of(measurement::metricHeight, "measurement.metric_height"),
+                TestSpec.of(measurement::metricVolume, "measurement.metric_volume"),
+                TestSpec.of(measurement::metricWeight, "measurement.metric_weight"));
+        }
+    }
 }

Maybe also go back and add tests for your other addition too "wink:

@gvrettos
Copy link
Contributor Author

@kingthorin thank you very much for the boost with the tests. 👍
I also went back to any providers I had added support for Greek in the past and I added the respective tests there, too.

@kingthorin kingthorin changed the title Add greek translations for Measurement provider Add greek translations for Measurement provider & other Greek tests Oct 27, 2024
@kingthorin kingthorin merged commit e90e297 into datafaker-net:main Oct 27, 2024
12 checks passed
@gvrettos gvrettos deleted the feature/measurement-el_GR branch October 27, 2024 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants