Repository navigation
fix: use Locale.US for float formatting to prevent syntax errors - #39
Conversation
Summary of ChangesHello @kingsword09, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a critical bug where the generated Compose code could fail to compile due to locale-dependent formatting of floating-point numbers. By explicitly setting the locale to Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly fixes a locale-dependent float formatting bug by explicitly using Locale.US when formatting numbers, which will prevent syntax errors in generated code on systems with different locales. The fix itself is solid. However, the pull request also includes test-specific configurations and generated files in the example project. These artifacts should be removed before merging to ensure the commit is focused solely on the bug fix and to keep the example project clean.
| // Simple Icons - for testing Locale issue (GitHub issue #38) | ||
| externalIcons("github", libraryName = "simple-icons") { | ||
| urlTemplate = "https://simpleicons.org/icons/{name}.svg" | ||
| } |
There was a problem hiding this comment.
This configuration for simple-icons was added for testing the locale fix. While useful for verification, such test-specific setup should not be committed to the main branch. Please remove this block to keep the example project's configuration clean and focused on demonstrating the library's intended usage.
| package io.github.kingsword09.example.icons.`simple-icons` | ||
|
|
||
| import androidx.compose.ui.graphics.vector.ImageVector | ||
| import io.github.kingsword09.example.icons.`simple-icons`.icons.GithubSimpleIcons | ||
| import kotlin.collections.List as ____KtList | ||
|
|
||
| public object Icons | ||
|
|
||
| private var __AllIcons: ____KtList<ImageVector>? = null | ||
|
|
||
| public val Icons.AllIcons: ____KtList<ImageVector> | ||
| get() { | ||
| if (__AllIcons != null) { | ||
| return __AllIcons!! | ||
| } | ||
| __AllIcons= listOf(GithubSimpleIcons) | ||
| return __AllIcons!! | ||
| } |
| package io.github.kingsword09.example.icons.`simple-icons`.icons | ||
|
|
||
| import androidx.compose.foundation.Image | ||
| import androidx.compose.foundation.layout.Box | ||
| import androidx.compose.foundation.layout.padding | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.graphics.Color | ||
| import androidx.compose.ui.graphics.PathFillType.Companion.NonZero | ||
| import androidx.compose.ui.graphics.SolidColor | ||
| import androidx.compose.ui.graphics.StrokeCap.Companion.Butt | ||
| import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter | ||
| import androidx.compose.ui.graphics.vector.ImageVector | ||
| import androidx.compose.ui.graphics.vector.ImageVector.Builder | ||
| import androidx.compose.ui.graphics.vector.path | ||
| import androidx.compose.ui.unit.dp | ||
| import io.github.kingsword09.example.icons.`simple-icons`.Icons | ||
| import org.jetbrains.compose.ui.tooling.preview.Preview | ||
|
|
||
| public val Icons.GithubSimpleIcons: ImageVector | ||
| get() { | ||
| if (_githubSimpleIcons != null) { | ||
| return _githubSimpleIcons!! | ||
| } | ||
| _githubSimpleIcons = Builder(name = "GithubSimpleIcons", defaultWidth = 24.0.dp, defaultHeight = 24.0.dp, viewportWidth = 24.0f, viewportHeight = 24.0f).apply { | ||
| path(fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f, pathFillType = NonZero) { | ||
| moveTo(12.0f, 0.30f) | ||
| curveToRelative(-6.63f, 0.0f, -12.0f, 5.37f, -12.0f, 12.0f) | ||
| curveToRelative(0.0f, 5.30f, 3.44f, 9.8f, 8.21f, 11.39f) | ||
| curveToRelative(0.6f, 0.11f, 0.82f, -0.26f, 0.82f, -0.58f) | ||
| curveToRelative(0.0f, -0.29f, -0.01f, -1.04f, -0.02f, -2.04f) | ||
| curveToRelative(-3.34f, 0.72f, -4.04f, -1.61f, -4.04f, -1.61f) | ||
| curveTo(4.42f, 18.07f, 3.63f, 17.7f, 3.63f, 17.7f) | ||
| curveToRelative(-1.09f, -0.74f, 0.08f, -0.73f, 0.08f, -0.73f) | ||
| curveToRelative(1.21f, 0.08f, 1.84f, 1.24f, 1.84f, 1.24f) | ||
| curveToRelative(1.07f, 1.84f, 2.81f, 1.31f, 3.50f, 1.00f) | ||
| curveToRelative(0.11f, -0.78f, 0.42f, -1.31f, 0.76f, -1.61f) | ||
| curveToRelative(-2.67f, -0.3f, -5.47f, -1.33f, -5.47f, -5.93f) | ||
| curveToRelative(0.0f, -1.31f, 0.47f, -2.38f, 1.24f, -3.22f) | ||
| curveToRelative(-0.14f, -0.30f, -0.54f, -1.52f, 0.11f, -3.18f) | ||
| curveToRelative(0.0f, 0.0f, 1.01f, -0.32f, 3.3f, 1.23f) | ||
| curveToRelative(0.96f, -0.27f, 1.98f, -0.40f, 3.0f, -0.41f) | ||
| curveToRelative(1.02f, 0.01f, 2.04f, 0.14f, 3.0f, 0.41f) | ||
| curveToRelative(2.28f, -1.55f, 3.29f, -1.23f, 3.29f, -1.23f) | ||
| curveToRelative(0.65f, 1.65f, 0.24f, 2.87f, 0.12f, 3.18f) | ||
| curveToRelative(0.77f, 0.84f, 1.23f, 1.91f, 1.23f, 3.22f) | ||
| curveToRelative(0.0f, 4.61f, -2.81f, 5.63f, -5.48f, 5.92f) | ||
| curveToRelative(0.42f, 0.36f, 0.81f, 1.10f, 0.81f, 2.22f) | ||
| curveToRelative(0.0f, 1.61f, -0.02f, 2.90f, -0.02f, 3.29f) | ||
| curveToRelative(0.0f, 0.32f, 0.21f, 0.69f, 0.83f, 0.57f) | ||
| curveTo(20.57f, 22.09f, 24.0f, 17.59f, 24.0f, 12.30f) | ||
| curveToRelative(0.0f, -6.63f, -5.37f, -12.0f, -12.0f, -12.0f) | ||
| } | ||
| } | ||
| .build() | ||
| return _githubSimpleIcons!! | ||
| } | ||
|
|
||
| private var _githubSimpleIcons: ImageVector? = null | ||
|
|
||
| @Preview | ||
| @Composable | ||
| private fun Preview() { | ||
| Box(modifier = Modifier.padding(12.dp)) { | ||
| Image(imageVector = Icons.GithubSimpleIcons, contentDescription = "") | ||
| } | ||
| } |
Closes: #38