틀:Percent
둘러보기로 이동
검색으로 이동
This template is used to apply a standard format to percentage values in an input string. It is mainly to be used inside other templates, and especially intended for proper localization of percentages, since different countries use different formats. Note that this means that the template may have no effect if used in the English wiki, since the input values are likely already in the correct English format.
Usage
{{ percent | <input string> }}
- First unnamed parameter
The input string. The template will detect and process the following:
- Percentages (natural and decimal, positive and negative)
- Decimals (positive and negative)
- Fractions (positive and negative)
- Any other valid
{{#[[[:틀:Tl/parser function links]]##expr expr]:}}
string
Notes
- Decimals, fractions, and the results of other expressions will be rounded to two decimal places.
- If the input string does not consist of any of the valid formats outlined above, a percentage sign will be simply be added to it.
- The template is faster if the percentage sign is omitted. Therefore, if the input (or the result of it, if it is an expression) is purely numerical, the percentage sign should be left out.
Examples
Code | Result | ||
---|---|---|---|
English | German | Turkish | |
{{percent|100%}}
|
틀:Lang/set 100% | 틀:Lang/set 100% | 틀:Lang/set 100% |
{{percent|16.67 %}}
|
틀:Lang/set 16.67% | 틀:Lang/set 16.67% | 틀:Lang/set 16.67% |
{{percent|50% {{note|paren=y|Hardmode}} / {{eicons|1.3.0.1}} {{expert|12.5%}}}}
|
틀:Lang/set 50% 틀:Note / 틀:Expert | 틀:Lang/set 50% 틀:Note / 틀:Expert | 틀:Lang/set 50% 틀:Note / 틀:Expert |
{{percent|1–3%}}
|
틀:Lang/set 1–3% | 틀:Lang/set 1–3% | 틀:Lang/set 1–3% |
{{percent|1.25–6.67%}}
|
틀:Lang/set 1.25–6.67% | 틀:Lang/set 1.25–6.67% | 틀:Lang/set 1.25–6.67% |
{{percent|0.12}}
|
틀:Lang/set 12% | 틀:Lang/set 12% | 틀:Lang/set 12% |
{{percent|2}}
|
틀:Lang/set 200% | 틀:Lang/set 200% | 틀:Lang/set 200% |
{{percent|1/8}}
|
틀:Lang/set 12.5% | 틀:Lang/set 12.5% | 틀:Lang/set 12.5% |
{{percent|22/39}}
|
틀:Lang/set 56.41% | 틀:Lang/set 56.41% | 틀:Lang/set 56.41% |
{{percent|(35/11 mod 2) - (10^-2 / ceil(21/6))}}
|
틀:Lang/set 99.75% | 틀:Lang/set 99.75% | 틀:Lang/set 99.75% |
{{percent|NaN}}
|
틀:Lang/set NaN% | 틀:Lang/set NaN% | 틀:Lang/set NaN% |
분류:
- Pages using DynamicPageList3 dplvar parser function
- Pages using DynamicPageList3 parser function
- Pages using DynamicPageList3 dplreplace parser function
- I18n-ready templates
- Templates using Lua
- Formatting templates