-
Notifications
You must be signed in to change notification settings - Fork 484
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
Exploration: Make Locale configurable for formatting of tags (not to be merged) #538
base: main
Are you sure you want to change the base?
Changes from all commits
bab48fb
ed768a5
c594940
e93e7df
bbf2cf9
2fe5f8f
60e67a6
44aaa41
63532a6
9608080
88497e2
aa71ef4
ffc5c93
a0b3508
06904a9
0e567cf
e1bcae9
4b51770
0d1b49b
ffb1829
dcae803
88f8fa9
1b1ed9d
15e6bb7
a38da78
6d9c38d
0e3655b
17f839c
f8035fb
866081c
3b6dbe7
dfea3db
a314058
37ff824
02cf06f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.drew.metadata; | ||
|
||
import com.drew.lang.annotations.NotNull; | ||
|
||
import java.util.Locale; | ||
|
||
/** | ||
* Context class for metadata. Contains settings used while extracting and formatting metadata. | ||
* | ||
* @author Roel van Dijk | ||
*/ | ||
public class MetadataContext | ||
{ | ||
/** | ||
* Locale used to format metadata. | ||
*/ | ||
private Locale _locale; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would make There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I fully agree with that! Since we only have a However, using the builder pattern would make this more future proof (albeit more verbose). |
||
|
||
/** | ||
* Initialize a context using the system default {@link Locale}. | ||
*/ | ||
public MetadataContext() | ||
{ | ||
_locale = Locale.getDefault(); | ||
} | ||
|
||
/** | ||
* Gets the configured {@link Locale}. | ||
* | ||
* @return the configured locale. | ||
*/ | ||
public Locale locale() | ||
{ | ||
return _locale; | ||
} | ||
|
||
/** | ||
* Configure the {@link Locale} to use for extracting and formatting metadata. | ||
* | ||
* @param locale the locale to use | ||
* @return this context | ||
*/ | ||
public MetadataContext locale(@NotNull final Locale locale) | ||
{ | ||
_locale = locale; | ||
return this; | ||
} | ||
|
||
} |
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.
As explained in the PR discussion: I've added this comment throughout to mark where
new MetadataContext()
is called, which is done mostly for backwards compatibility.