-
Notifications
You must be signed in to change notification settings - Fork 58
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
support of ->toCurrencyWords() for LV #26
Open
SailorMax
wants to merge
3
commits into
pear:master
Choose a base branch
from
SailorMax:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,14 +70,14 @@ class Numbers_Words_Locale_ru extends Numbers_Words | |
* @access public | ||
*/ | ||
var $lang_native = 'Русский'; | ||
|
||
/** | ||
* The word for the minus sign | ||
* @var string | ||
* @access private | ||
*/ | ||
var $_minus = 'минус'; // minus sign | ||
|
||
/** | ||
* The sufixes for exponents (singular) | ||
* Names partly based on: | ||
|
@@ -242,7 +242,7 @@ class Numbers_Words_Locale_ru extends Numbers_Words | |
); | ||
|
||
/** | ||
* The array containing the digits | ||
* The array containing the digits | ||
* for neutral, male and female | ||
* @var array | ||
* @access private | ||
|
@@ -272,23 +272,23 @@ class Numbers_Words_Locale_ru extends Numbers_Words | |
*/ | ||
var $_currency_names = array( | ||
'ALL' => array( | ||
array(1, 'лек', 'лека', 'леков'), | ||
array(1, 'лек', 'лека', 'леков'), | ||
array(2, 'киндарка', 'киндарки', 'киндарок') | ||
), | ||
'AUD' => array( | ||
array(1, 'австралийский доллар', 'австралийских доллара', 'австралийских долларов'), | ||
array(1, 'цент', 'цента', 'центов') | ||
), | ||
'BGN' => array( | ||
array(1, 'лев', 'лева', 'левов'), | ||
array(1, 'лев', 'лева', 'левов'), | ||
array(2, 'стотинка', 'стотинки', 'стотинок') | ||
), | ||
'BRL' => array( | ||
array(1, 'бразильский реал', 'бразильских реала', 'бразильских реалов'), | ||
array(1, 'бразильский реал', 'бразильских реала', 'бразильских реалов'), | ||
array(1, 'сентаво', 'сентаво', 'сентаво') | ||
), | ||
'BYR' => array( | ||
array(1, 'белорусский рубль', 'белорусских рубля', 'белорусских рублей'), | ||
array(1, 'белорусский рубль', 'белорусских рубля', 'белорусских рублей'), | ||
array(2, 'копейка', 'копейки', 'копеек') | ||
), | ||
'CAD' => array( | ||
|
@@ -439,7 +439,7 @@ class Numbers_Words_Locale_ru extends Numbers_Words | |
* @author Andrey Demenev <[email protected]> | ||
* @since Numbers_Words 0.16.3 | ||
*/ | ||
function _toWords($num, $options = array()) | ||
function _toWords($num, $options = array()) | ||
{ | ||
$dummy = null; | ||
$gender = 1; | ||
|
@@ -472,9 +472,9 @@ function _toWordsWithCase($num, &$case, $gender = 1) | |
{ | ||
$ret = ''; | ||
$case = 3; | ||
|
||
$num = trim($num); | ||
|
||
$sign = ""; | ||
if (substr($num, 0, 1) == '-') { | ||
$sign = $this->_minus . $this->_sep; | ||
|
@@ -552,7 +552,7 @@ function _toWordsWithCase($num, &$case, $gender = 1) | |
*/ | ||
function _groupToWords($num, $gender, &$case) | ||
{ | ||
$ret = ''; | ||
$ret = ''; | ||
$case = 3; | ||
|
||
if ((int)$num == 0) { | ||
|
@@ -562,7 +562,7 @@ function _groupToWords($num, $gender, &$case) | |
if ($num == 1) { | ||
$case = 1; | ||
} elseif ($num < 5) { | ||
$case = 2; | ||
$case = 2; | ||
} else { | ||
$case = 3; | ||
} | ||
|
@@ -632,15 +632,23 @@ function _groupToWords($num, $gender, &$case) | |
*/ | ||
function toCurrencyWords($int_curr, $decimal, $fraction = false, $convert_fraction = true) | ||
{ | ||
$int_curr = strtoupper($int_curr); | ||
if (!isset($this->_currency_names[$int_curr])) { | ||
$int_curr = $this->def_currency; | ||
} | ||
|
||
$curr_names = $this->_currency_names[$int_curr]; | ||
|
||
if (is_array($int_curr)) | ||
$curr_names = $int_curr; | ||
else | ||
{ | ||
$int_curr = strtoupper($int_curr); | ||
if (!isset($this->_currency_names[$int_curr])) { | ||
$int_curr = $this->def_currency; | ||
} | ||
$curr_names = $this->_currency_names[$int_curr]; | ||
} | ||
|
||
$case = null; | ||
$ret = trim($this->_toWordsWithCase($decimal, $case, $curr_names[0][0])); | ||
$ret .= $this->_sep . $curr_names[0][$case]; | ||
if (Numbers_Words::$useAbbrAsDecimalNames) | ||
$ret .= $this->_sep . $int_curr; | ||
else | ||
$ret .= $this->_sep . $curr_names[0][$case]; | ||
|
||
if ($fraction !== false) { | ||
if ($convert_fraction) { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tabs vs spaces - run PHPCS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.