# GlobalizationService

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-protranslate-core/struct-globalizationservice/

**struct** · [`ferroui-protranslate-core`](/docs/0.5.0/api/ferroui-protranslate-core/) · v0.5.0

```rust
struct GlobalizationService
```



[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/globalization.rs#L17)

## Members

- [`new`](#function-new)
- [`with_services`](#function-with_services)
- [`cultures`](#function-cultures)
- [`translations`](#function-translations)
- [`unit_converter`](#function-unit_converter)
- [`unit_formatter`](#function-unit_formatter)
- [`current_culture`](#function-current_culture)
- [`flow_direction`](#function-flow_direction)
- [`set_culture`](#function-set_culture)
- [`get_string`](#function-get_string)
- [`region_profile`](#function-region_profile)
- [`measurement_system_profile`](#function-measurement_system_profile)
- [`measurement_system`](#function-measurement_system)
- [`is_metric`](#function-is_metric)
- [`set_region_override`](#function-set_region_override)
- [`clear_region_override`](#function-clear_region_override)
- [`set_measurement_system_override`](#function-set_measurement_system_override)
- [`clear_measurement_system_override`](#function-clear_measurement_system_override)
- [`convert_measurement`](#function-convert_measurement)
- [`format_measurement`](#function-format_measurement)
- [`format_measurement_for_profile`](#function-format_measurement_for_profile)
- [`subscribe`](#function-subscribe)

<a id="function-new"></a>

### new

```rust
fn new(translations: TranslationService) -> Self
```

Uses the translation service's culture source, so lookup and display state
cannot accidentally diverge through two unrelated culture services.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/globalization.rs#L21)

<a id="function-with_services"></a>

### with_services

```rust
fn with_services(translations: TranslationService, region_provider: Rc<dyn RegionProfileProvider>, resolver: Rc<dyn MeasurementSystemResolver>, converter: Rc<dyn UnitConversionService>, formatter: Rc<dyn LocalizedUnitFormatter>) -> Self
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/globalization.rs#L30)

<a id="function-cultures"></a>

### cultures

```rust
fn cultures(self: &Self) -> CultureService
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/globalization.rs#L61)

<a id="function-translations"></a>

### translations

```rust
fn translations(self: &Self) -> TranslationService
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/globalization.rs#L64)

<a id="function-unit_converter"></a>

### unit_converter

```rust
fn unit_converter(self: &Self) -> Rc<dyn UnitConversionService>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/globalization.rs#L67)

<a id="function-unit_formatter"></a>

### unit_formatter

```rust
fn unit_formatter(self: &Self) -> Rc<dyn LocalizedUnitFormatter>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/globalization.rs#L70)

<a id="function-current_culture"></a>

### current_culture

```rust
fn current_culture(self: &Self) -> Culture
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/globalization.rs#L73)

<a id="function-flow_direction"></a>

### flow_direction

```rust
fn flow_direction(self: &Self) -> TextFlowDirection
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/globalization.rs#L76)

<a id="function-set_culture"></a>

### set_culture

```rust
fn set_culture(self: &Self, culture: Culture) -> bool
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/globalization.rs#L79)

<a id="function-get_string"></a>

### get_string

```rust
fn get_string(self: &Self, key: &str) -> Result<LocalizedString, TranslationError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/globalization.rs#L82)

<a id="function-region_profile"></a>

### region_profile

```rust
fn region_profile(self: &Self) -> Result<RegionProfile, TranslationError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/globalization.rs#L85)

<a id="function-measurement_system_profile"></a>

### measurement_system_profile

```rust
fn measurement_system_profile(self: &Self) -> Result<MeasurementSystemProfile, TranslationError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/globalization.rs#L109)

<a id="function-measurement_system"></a>

### measurement_system

```rust
fn measurement_system(self: &Self) -> Result<MeasurementSystem, TranslationError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/globalization.rs#L123)

<a id="function-is_metric"></a>

### is_metric

```rust
fn is_metric(self: &Self) -> Result<bool, TranslationError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/globalization.rs#L126)

<a id="function-set_region_override"></a>

### set_region_override

```rust
fn set_region_override(self: &Self, region: RegionProfile) -> bool
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/globalization.rs#L129)

<a id="function-clear_region_override"></a>

### clear_region_override

```rust
fn clear_region_override(self: &Self) -> bool
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/globalization.rs#L137)

<a id="function-set_measurement_system_override"></a>

### set_measurement_system_override

```rust
fn set_measurement_system_override(self: &Self, system: MeasurementSystem) -> bool
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/globalization.rs#L144)

<a id="function-clear_measurement_system_override"></a>

### clear_measurement_system_override

```rust
fn clear_measurement_system_override(self: &Self) -> bool
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/globalization.rs#L152)

<a id="function-convert_measurement"></a>

### convert_measurement

```rust
fn convert_measurement(self: &Self, value: f64, source: MeasurementUnit) -> Result<MeasurementValue, TranslationError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/globalization.rs#L159)

<a id="function-format_measurement"></a>

### format_measurement

```rust
fn format_measurement(self: &Self, value: f64, unit: MeasurementUnit, format: Option<&str>) -> Result<String, TranslationError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/globalization.rs#L168)

<a id="function-format_measurement_for_profile"></a>

### format_measurement_for_profile

```rust
fn format_measurement_for_profile(self: &Self, value: f64, source: MeasurementUnit, format: Option<&str>) -> Result<String, TranslationError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/globalization.rs#L180)

<a id="function-subscribe"></a>

### subscribe

```rust
fn subscribe(self: &Self, callback: impl Fn(&CultureChangedEventArgs) -> () + 'static) -> Subscription
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Core/globalization.rs#L194)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- `ErasedDestructor`
- `IntoEither`
- `Clone`

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
