๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๋นˆ ๊ตฌ๋ฉ ์ฑ„์šฐ๊ธฐ

[Android] Potential Plurals / Quantity strings + ์‚ฝ์งˆ

Android Studio์˜ Analyze > Inspect Code๋ฅผ ํ†ตํ•ด ๋‚˜์˜จ Warning๋“ค ์ค‘ ํ•˜๋‚˜๋กœ "Potential Plurals"๋ฅผ ๋ฐœ๊ฒฌํ–ˆ๋‹ค.

 

 

์Šคํƒ์˜ค๋ฒ„ํ”Œ๋กœ์šฐ ์„ ๋ฐฐ๋‹˜๋“ค

https://stackoverflow.com/questions/47439853/lint-check-potential-plurals

 

Lint check potential plurals?

My Lintcheck complains regarding my string resources. Potential Plurals res/values/strings.xml Formatting %d followed by words ("Pers"): This should probably be a plural rather than a string ...

stackoverflow.com

 

๊ณต์‹ ๋ฌธ์„œ

https://developer.android.com/guide/topics/resources/string-resource#Plurals

 

๋ฌธ์ž์—ด ๋ฆฌ์†Œ์Šค  |  Android ๊ฐœ๋ฐœ์ž  |  Android Developers

๋ฌธ์ž์—ด ๋ฆฌ์†Œ์Šค ๋ฌธ์ž์—ด ๋ฆฌ์†Œ์Šค๋Š” ์˜ต์…˜ ์‚ฌํ•ญ์ธ ํ…์ŠคํŠธ ์Šคํƒ€์ผ ์ง€์ • ๋ฐ ์„œ์‹ ์ง€์ • ๊ธฐ๋Šฅ๊ณผ ํ•จ๊ป˜ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์— ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ํ…์ŠคํŠธ ๋ฌธ์ž์—ด์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์— ๋ฌธ์ž์—ด์„ ์ œ๊ณตํ•  ์ˆ˜

developer.android.com

 

Context.getQuntityString() ๋ฌธ์„œ

https://developer.android.com/reference/android/content/res/Resources#getQuantityString(int,%20int) 

 

Resources  |  Android Developers

 

developer.android.com

 

 

๊ทธ๋Ÿฐ๋ฐ

 

1) ํ•œ๊ตญ์–ด๋Š” ์•ˆ ๋จนํžŒ๋‹ค.

2) ๋ณต์ˆ˜ํ˜•๋งŒ ์ทจ๊ธ‰ํ•œ๋‹ค.

 

1) ๊ณต์‹ ๋ฌธ์ž์—ด ๋ฆฌ์†Œ์Šค ๋ฌธ์„œ ๋‚ด์šฉ ์ค‘. ํ•œ๊ตญ์–ด๋Š” ์˜๋ฏธ์—†๋‹ค...

 

2) ๊ณต์‹ ๋ฌธ์ž์—ด ๋ฆฌ์†Œ์Šค ๋ฌธ์„œ ๋‚ด์šฉ ์ค‘. ๋ณต์ˆ˜ํ˜•์—์„œ๋งŒ ์“ฐ์ธ๋‹ค๊ณ .

 

์ €๊ฒƒ๋“ค์„ ์ œ๋Œ€๋กœ ์ธ์‹ํ•˜์ง€ ๋ชปํ–‡ ์‚ฝ์งˆ์„ ํ–ˆ๋‹ค.๐Ÿคฆ‍โ™‚๏ธ๐Ÿคฆ‍โ™€๏ธ

0์œผ๋กœ ๋ถ„๊ธฐ์ฒ˜๋ฆฌํ•œ ๋ฌธ๊ตฌ๋“ค์— ์ข€ ์“ธ ์ˆ˜ ์žˆ์„๊นŒ ํ–ˆ์—ˆ๋Š”๋ฐ ์‹คํŒจ.