mirror of https://github.com/docusealco/docuseal
				
				
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							18 lines
						
					
					
						
							348 B
						
					
					
				
			
		
		
	
	
							18 lines
						
					
					
						
							348 B
						
					
					
				# frozen_string_literal: true
 | 
						|
 | 
						|
module TextUtils
 | 
						|
  RTL_REGEXP = /[\p{Hebrew}\p{Arabic}]/
 | 
						|
 | 
						|
  module_function
 | 
						|
 | 
						|
  def maybe_rtl_reverse(text)
 | 
						|
    if text.match?(RTL_REGEXP)
 | 
						|
      TwitterCldr::Shared::Bidi
 | 
						|
        .from_string(ArabicLetterConnector.transform(text), direction: :RTL)
 | 
						|
        .reorder_visually!.to_s
 | 
						|
    else
 | 
						|
      text
 | 
						|
    end
 | 
						|
  end
 | 
						|
end
 |