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

Bugfix when use tr locale #30

Closed
wants to merge 17 commits into from
Closed

Conversation

jershell
Copy link
Contributor

This bugfix . It cause then user select turkish locale on android device. This example desmonstrate troube

package com.github.test.error

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import java.util.*

internal enum class OperationType {
    QUERY,
    MUTATION
}

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        val trLocaleFromOsSettings = Locale("tr")
        val enLocaleSoSettings = Locale.ENGLISH
        val sTypeFromEnumField = OperationType.MUTATION.name.toLowerCase(trLocaleFromOsSettings)
        val sTypeFromString = "MUTATION".toLowerCase(trLocaleFromOsSettings)
        val sTypeFromInit = "mutation"
        Log.d("TEST", "LOCALE -> ${trLocaleFromOsSettings.language}")

        Log.d("TEST", "sTypeFromEnumField -> $sTypeFromEnumField")
        Log.d("TEST", "sTypeFromString -> $sTypeFromString")
        Log.d("TEST", "sTypeFromString -> $sTypeFromString")
        Log.d("TEST", "sTyleFromInit -> $sTypeFromInit")
        Log.d("TEST", "sTyleFromInit == sTypeFromString -> ${sTypeFromInit == sTypeFromString}")
        Log.d("TEST", "sTyleFromInit == sTypeFromString -> ${sTypeFromInit == sTypeFromEnumField}")
    }
}


Output:

06-17 17:00:31.166 27489-27489/? D/TEST: LOCALE -> tr
06-17 17:00:31.166 27489-27489/? D/TEST: sTypeFromEnumField -> mutatıon
06-17 17:00:31.166 27489-27489/? D/TEST: sTypeFromString -> mutatıon
06-17 17:00:31.166 27489-27489/? D/TEST: sTypeFromString -> mutatıon
06-17 17:00:31.166 27489-27489/? D/TEST: sTyleFromInit -> mutation
06-17 17:00:31.166 27489-27489/? D/TEST: sTyleFromInit == sTypeFromString -> false
06-17 17:00:31.166 27489-27489/? D/TEST: sTyleFromInit == sTypeFromString -> false

i didnt use Locale.ENGLISH since i want to avoid java dependencies

VerachadW and others added 17 commits September 27, 2016 22:01
* Update Spek version

* Fix print wrong escaped character, Fix VerachadW#4

* Rewrite the GraphQLPrintSpek for preetty print test

* Bump hotfix version

* Update build status link
* bump to kotlin v1.1.1

* Add type alias for more readable code

* Change the package name to me.lazmaid.kraph

* Fix build failed dur to hamkrest error

* Update spek version

* Update ENV for release

* Update README
* WIP

* Split the print logic into sealed class

* Update UTs

* Add exception message

* Refactor
* Add Test Coverage

* Update spek version

* Fix test result path

* Add codecov YAML

* Add onlyIf

* Update config

* Fix travis command

* Add coverage badge
* Add support for boolean type

* Add Tests
missing "h" in the example call to `println(query.toGrapQueryString())`
* improve readme

* Allow using field with a block in place of field object

* Update readme to include new changes

* Cheap implementation of fragment that doesn't use actual GraphQL Fragments

* Add fragment docs to readme

* Fix tests

* Change function to 'defineFragment'
* Update .gitignore

* Update dependecies

* Add secondary constructor for DataEntry.NonDecimalNUmber

* Add Test for DataEntry classes

* Fix failed UTs
* improve readme

* Allow using field with a block in place of field object

* Update readme to include new changes

* Cheap implementation of fragment that doesn't use actual GraphQL Fragments

* Add fragment docs to readme

* Fix tests

* Add separate methods to print the different parts of the request separately

* Use spaces instead of newlines for request format

* Rewrite printing operations to optionally escape quotes

* update readme a bit

* Change function to 'defineFragment'

* Use an enum to choose print format and write tests to cover all formats

* Add note about variables
* add support for variables

* add support for variables
@codecov-io
Copy link

codecov-io commented Jun 17, 2019

Codecov Report

❗ No coverage uploaded for pull request base (develop@2b39841). Click here to learn what that means.
The diff coverage is 82.6%.

Impacted file tree graph

@@            Coverage Diff             @@
##             develop      #30   +/-   ##
==========================================
  Coverage           ?   83.43%           
  Complexity         ?       68           
==========================================
  Files              ?       16           
  Lines              ?      157           
  Branches           ?       28           
==========================================
  Hits               ?      131           
  Misses             ?       10           
  Partials           ?       16
Impacted Files Coverage Δ Complexity Δ
...e/lazmaid/kraph/NoFieldsInSelectionSetException.kt 100% <ø> (ø) 1 <0> (?)
...otlin/me/lazmaid/kraph/lang/relay/RelayMutation.kt 100% <ø> (ø) 0 <0> (?)
...rc/main/kotlin/me/lazmaid/kraph/lang/relay/Node.kt 0% <ø> (ø) 0 <0> (?)
.../main/kotlin/me/lazmaid/kraph/lang/SelectionSet.kt 100% <100%> (ø) 3 <3> (?)
.../src/main/kotlin/me/lazmaid/kraph/lang/Document.kt 100% <100%> (ø) 5 <5> (?)
...src/main/kotlin/me/lazmaid/kraph/lang/Variables.kt 100% <100%> (ø) 9 <9> (?)
...src/main/kotlin/me/lazmaid/kraph/lang/DataEntry.kt 100% <100%> (ø) 1 <1> (?)
...kotlin/me/lazmaid/kraph/NoSuchFragmentException.kt 100% <100%> (ø) 1 <1> (?)
...otlin/me/lazmaid/kraph/lang/relay/InputArgument.kt 100% <100%> (ø) 2 <2> (?)
.../main/kotlin/me/lazmaid/kraph/types/CustomTypes.kt 100% <100%> (ø) 0 <0> (?)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2b39841...fccf411. Read the comment docs.

@VerachadW VerachadW changed the base branch from master to develop October 5, 2019 09:32
@VerachadW VerachadW changed the base branch from develop to master October 5, 2019 09:32
@VerachadW
Copy link
Owner

Hi, Sorry for the very delay. If you can change your changes to develop it would be very appreciated.

@jershell jershell changed the base branch from master to develop October 6, 2019 08:10
@jershell jershell closed this Oct 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants