Attempt to support plural forms in the matches counter of the findbar (issue 10067)
Based on a quick look at https://github.com/fabi1cazenave/webL10n/#pluralization, it seems that supporting plural forms shouldn't be as difficult as I first thought it might be.
This commit is contained in:
		
							parent
							
								
									6adeabbb66
								
							
						
					
					
						commit
						6c4157acd9
					
				| @ -168,13 +168,20 @@ find_match_case_label=Match case | |||||||
| find_entire_word_label=Whole words | find_entire_word_label=Whole words | ||||||
| find_reached_top=Reached top of document, continued from bottom | find_reached_top=Reached top of document, continued from bottom | ||||||
| find_reached_bottom=Reached end of document, continued from top | find_reached_bottom=Reached end of document, continued from top | ||||||
| # LOCALIZATION NOTE (find_matches_count): "{{current}}" and "{{total}}" will be | # LOCALIZATION NOTE (find_matches_count): The supported plural forms are | ||||||
| # replaced by a number representing the index of the currently active find result, | # [zero|one|two|few|many|other], with [other] as the default value. | ||||||
| # respectively a number representing the total number of matches in the document. | # "{{current}}" and "{{total}}" will be replaced by a number representing the | ||||||
| find_matches_count={{current}} of {{total}} matches | # index of the currently active find result, respectively a number representing | ||||||
| # LOCALIZATION NOTE (find_matches_count_limit): "{{limit}}" will be replaced by | # the total number of matches in the document. | ||||||
| # a numerical value. | find_matches_count={[ plural(n) ]} | ||||||
| find_matches_count_limit=More than {{limit}} matches | find_matches_count[one]={{current}} of {{total}} match | ||||||
|  | find_matches_count[other]={{current}} of {{total}} matches | ||||||
|  | # LOCALIZATION NOTE (find_matches_count_limit): The supported plural forms are | ||||||
|  | # [zero|one|two|few|many|other], with [other] as the default value. | ||||||
|  | # "{{limit}}" will be replaced by a numerical value. | ||||||
|  | find_matches_count_limit={[ plural(n) ]} | ||||||
|  | find_matches_count_limit[one]=More than {{limit}} match | ||||||
|  | find_matches_count_limit[other]=More than {{limit}} matches | ||||||
| find_not_found=Phrase not found | find_not_found=Phrase not found | ||||||
| 
 | 
 | ||||||
| # Error panel labels | # Error panel labels | ||||||
|  | |||||||
| @ -168,13 +168,20 @@ find_match_case_label=Hoofdlettergevoelig | |||||||
| find_entire_word_label=Hele woorden | find_entire_word_label=Hele woorden | ||||||
| find_reached_top=Bovenkant van document bereikt, doorgegaan vanaf onderkant | find_reached_top=Bovenkant van document bereikt, doorgegaan vanaf onderkant | ||||||
| find_reached_bottom=Onderkant van document bereikt, doorgegaan vanaf bovenkant | find_reached_bottom=Onderkant van document bereikt, doorgegaan vanaf bovenkant | ||||||
| # LOCALIZATION NOTE (find_matches_count): "{{current}}" and "{{total}}" will be | # LOCALIZATION NOTE (find_matches_count): The supported plural forms are | ||||||
| # replaced by a number representing the index of the currently active find result, | # [zero|one|two|few|many|other], with [other] as the default value. | ||||||
| # respectively a number representing the total number of matches in the document. | # "{{current}}" and "{{total}}" will be replaced by a number representing the | ||||||
| find_matches_count={{current}} van {{total}} overeenkomsten | # index of the currently active find result, respectively a number representing | ||||||
| # LOCALIZATION NOTE (find_matches_count_limit): "{{limit}}" will be replaced by | # the total number of matches in the document. | ||||||
| # a numerical value. | find_matches_count={[ plural(n) ]} | ||||||
| find_matches_count_limit=Meer dan {{limit}} overeenkomsten | find_matches_count[one]={{current}} van {{total}} overeenkomst | ||||||
|  | find_matches_count[other]={{current}} van {{total}} overeenkomsten | ||||||
|  | # LOCALIZATION NOTE (find_matches_count_limit): The supported plural forms are | ||||||
|  | # [zero|one|two|few|many|other], with [other] as the default value. | ||||||
|  | # "{{limit}}" will be replaced by a numerical value. | ||||||
|  | find_matches_count_limit={[ plural(n) ]} | ||||||
|  | find_matches_count_limit[one]=Meer dan {{limit}} overeenkomst | ||||||
|  | find_matches_count_limit[other]=Meer dan {{limit}} overeenkomsten | ||||||
| find_not_found=Tekst niet gevonden | find_not_found=Tekst niet gevonden | ||||||
| 
 | 
 | ||||||
| # Error panel labels | # Error panel labels | ||||||
|  | |||||||
| @ -168,13 +168,20 @@ find_match_case_label=Matcha versal/gemen | |||||||
| find_entire_word_label=Hela ord | find_entire_word_label=Hela ord | ||||||
| find_reached_top=Nådde början av dokumentet, började från slutet | find_reached_top=Nådde början av dokumentet, började från slutet | ||||||
| find_reached_bottom=Nådde slutet på dokumentet, började från början | find_reached_bottom=Nådde slutet på dokumentet, började från början | ||||||
| # LOCALIZATION NOTE (find_matches_count): "{{current}}" and "{{total}}" will be | # LOCALIZATION NOTE (find_matches_count): The supported plural forms are | ||||||
| # replaced by a number representing the index of the currently active find result, | # [zero|one|two|few|many|other], with [other] as the default value. | ||||||
| # respectively a number representing the total number of matches in the document. | # "{{current}}" and "{{total}}" will be replaced by a number representing the | ||||||
| find_matches_count={{current}} av {{total}} matchande | # index of the currently active find result, respectively a number representing | ||||||
| # LOCALIZATION NOTE (find_matches_count_limit): "{{limit}}" will be replaced by | # the total number of matches in the document. | ||||||
| # a numerical value. | find_matches_count={[ plural(n) ]} | ||||||
| find_matches_count_limit=Fler än {{limit}} matchningar | find_matches_count[one]={{current}} av {{total}} matchningar | ||||||
|  | find_matches_count[other]={{current}} av {{total}} matchande | ||||||
|  | # LOCALIZATION NOTE (find_matches_count_limit): The supported plural forms are | ||||||
|  | # [zero|one|two|few|many|other], with [other] as the default value. | ||||||
|  | # "{{limit}}" will be replaced by a numerical value. | ||||||
|  | find_matches_count_limit={[ plural(n) ]} | ||||||
|  | find_matches_count_limit[one]=Fler än {{limit}} matchning | ||||||
|  | find_matches_count_limit[other]=Fler än {{limit}} matchningar | ||||||
| find_not_found=Frasen hittades inte | find_not_found=Frasen hittades inte | ||||||
| 
 | 
 | ||||||
| # Error panel labels | # Error panel labels | ||||||
|  | |||||||
| @ -157,18 +157,20 @@ class PDFFindBar { | |||||||
|     if (!this.findResultsCount) { |     if (!this.findResultsCount) { | ||||||
|       return; // No UI control is provided.
 |       return; // No UI control is provided.
 | ||||||
|     } |     } | ||||||
|     let matchesCountMsg = ''; |     let matchesCountMsg = '', limit = MATCHES_COUNT_LIMIT; | ||||||
| 
 | 
 | ||||||
|     if (total) { |     if (total) { | ||||||
|       if (total > MATCHES_COUNT_LIMIT) { |       if (total > limit) { | ||||||
|         matchesCountMsg = this.l10n.get('find_matches_count_limit', { |         matchesCountMsg = this.l10n.get('find_matches_count_limit', { | ||||||
|           limit: MATCHES_COUNT_LIMIT.toLocaleString(), |           n: limit, | ||||||
|         }, 'More than {{limit}} matches'); |           limit: limit.toLocaleString(), | ||||||
|  |         }, 'More than {{limit}} match' + (limit !== 1 ? 'es' : '')); | ||||||
|       } else { |       } else { | ||||||
|         matchesCountMsg = this.l10n.get('find_matches_count', { |         matchesCountMsg = this.l10n.get('find_matches_count', { | ||||||
|  |           n: total, | ||||||
|           current: current.toLocaleString(), |           current: current.toLocaleString(), | ||||||
|           total: total.toLocaleString(), |           total: total.toLocaleString(), | ||||||
|         }, '{{current}} of {{total}} matches'); |         }, '{{current}} of {{total}} match' + (total !== 1 ? 'es' : '')); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     Promise.resolve(matchesCountMsg).then((msg) => { |     Promise.resolve(matchesCountMsg).then((msg) => { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user