MCPcopy Index your code
hub / github.com/DeepL/deepl-python / remove_regional_variant

Method remove_regional_variant

deepl/api_data.py:251–257  ·  view source on GitHub ↗

Removes the regional variant from a language, e.g. EN-US gives EN

(language: Union[str, "Language"])

Source from the content-addressed store, hash-verified

249
250 @staticmethod
251 def remove_regional_variant(language: Union[str, "Language"]) -> str:
252 """Removes the regional variant from a language, e.g. EN-US gives EN"""
253 dash_index = str(language).find("-")
254 if dash_index != -1:
255 return str(language).upper()[0:dash_index]
256 else:
257 return str(language).upper()
258
259 ACEHNESE = "ace"
260 AFRIKAANS = "af"

Calls

no outgoing calls

Tested by 2

test_example_translationFunction · 0.64