-
Notifications
You must be signed in to change notification settings - Fork 549
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
Add localization #2748
Open
mosuem
wants to merge
20
commits into
main
Choose a base branch
from
addLocalization
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add localization #2748
Changes from 19 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
c8fa740
Add english arb file
mosuem 4a41aba
Add Flutter localizations
mosuem f84ae43
Add test locale
mosuem ebd0586
Add localization example
mosuem 5d01ab4
Switch to template
mosuem 58aef90
Make final
mosuem 948bd91
Change deps
mosuem 4852c20
Regenerate
mosuem 3a8333c
Add readme
mosuem c52f6e3
Remove unsupported locales
mosuem ba05735
Fix readme
mosuem 3cc8300
Add button to change locale
mosuem fe95aa0
Add build verify
mosuem deea7c0
Remove toast
mosuem 58ba66b
Rev flutter_messages
mosuem 77cbabd
Merge branch 'main' into addLocalization
mosuem 3fa10c6
Fix
mosuem 4a6497a
Fix language selection
mosuem ba00e09
Add translations
mosuem dc42857
Update pkgs/sketch_pad/lib/l10n/en.g.dart
devoncarew File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"@@locale": "de", | ||
"@@x-template": "en.arb", | ||
"newPad": "Neu", | ||
"samples": "Beispiele", | ||
"installSdk": "SDK installieren", | ||
"privacyNotice": "Datenschutzerklärung", | ||
"feedback": "Feedback", | ||
"channelSelection": "{channelName} channel", | ||
"toggleBrightness": "Helligkeit umschalten", | ||
"runButton": "Ausführen", | ||
"clearConsole": "Konsole löschen", | ||
"format": "Formatieren", | ||
"noFormattingChanges": "Keine Änderungen beim Formatieren", | ||
"formatSuccesful": "Formatieren erfolgreich", | ||
"errorFormatting": "Fehler beim formatieren", | ||
"compilationFailed": "Kompilierung fehlgeschlagen", | ||
"keyboardShortcuts": "Tastenkombinationen", | ||
"newSnippet": "Neues {type} snippet", | ||
"switchedToDartAndFlutter": "Zu Dart {dartVersion} and Flutter {flutterVersion} gewechselt", | ||
"sharingGuide": "Leitfaden zum Teilen", | ||
"dartpadGithub": "DartPad auf GitHub", | ||
"command": "Befehl", | ||
"keyboardShortcut": "Tastenkombination", | ||
"runtimeVersions": "Runtime-Versionen", | ||
"basedOnDartAndFlutter": "Based on Dart SDK {dartVersion} and Flutter SDK {flutterVersion}", | ||
"experimentsEnabled": "Experiments enabled: {experiments}", | ||
"package": "Paket", | ||
"version": "Version", | ||
"createNewSnippet": "Neues {type} Snippet erstellt", | ||
"codeCompletion": "Code Vervollständigung", | ||
"find": "Finden", | ||
"findNext": "Nächstes finden", | ||
"quickFixes": "Quick-Fixes", | ||
"reload": "Neu laden" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[0,"de","fhb5q58f",0,null,["Based on Dart SDK and Flutter SDK ",[18,0],[35,1]],[" channel",[0,0]],"Konsole löschen","Code Vervollständigung","Befehl","Kompilierung fehlgeschlagen",["Neues Snippet erstellt",[6,0]],"DartPad auf GitHub","Fehler beim formatieren",["Experiments enabled: ",[21,0]],"Feedback","Finden","Nächstes finden","Formatieren","Formatieren erfolgreich","SDK installieren","Tastenkombination","Tastenkombinationen","Neu",["Neues snippet",[6,0]],"Keine Änderungen beim Formatieren","Paket","Datenschutzerklärung","Quick-Fixes","Neu laden","Ausführen","Runtime-Versionen","Beispiele","Leitfaden zum Teilen",["Zu Dart and Flutter gewechselt",[8,0],[21,1]],"Helligkeit umschalten","Version"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
{ | ||
"@@locale": "en", | ||
"newPad": "New", | ||
"@newPad": { | ||
"description": "Button to create a new pad" | ||
}, | ||
"samples": "Samples", | ||
"@samples": { | ||
"description": "Button to show a list of all samples" | ||
}, | ||
"installSdk": "Install SDK", | ||
"@installSdk": { | ||
"description": "Button to follow external link to webpage helping on installing the Dart SDK" | ||
}, | ||
"privacyNotice": "Privacy Notice", | ||
"@privacyNotice": { | ||
"description": "Button to show privacy notice on external web page" | ||
}, | ||
"feedback": "Feedback", | ||
"@feedback": { | ||
"description": "Button to give feedback on external web page" | ||
}, | ||
"channelSelection": "{channelName} channel", | ||
"@channelSelection": { | ||
"description": "Text field describing the Dart SDK channel selected by the user", | ||
"placeholders": { | ||
"channelName": { | ||
"type": "String", | ||
"description": "The name of the channel", | ||
"example": "Stable" | ||
} | ||
} | ||
}, | ||
"toggleBrightness": "Toggle brightness", | ||
"@toggleBrightness": { | ||
"description": "Toggle brightness button tooltip" | ||
}, | ||
"runButton": "Run", | ||
"@runButton": { | ||
"description": "Run button" | ||
}, | ||
"clearConsole": "Clear console", | ||
"@clearConsole": { | ||
"description": "Clear Console button tooltip" | ||
}, | ||
"format": "Format", | ||
"@format": { | ||
"description": "Format tooltip" | ||
}, | ||
"noFormattingChanges": "No formatting changes", | ||
"@noFormattingChanges": { | ||
"description": "No formatting changes toast" | ||
}, | ||
"formatSuccesful": "Format successful", | ||
"@formatSuccesful": { | ||
"description": "Format succesful toast" | ||
}, | ||
"errorFormatting": "Error formatting code", | ||
"@errorFormatting": { | ||
"description": "Error formatting code toast" | ||
}, | ||
"compilationFailed": "Compilation failed", | ||
"@compilationFailed": { | ||
"description": "Compilation failed" | ||
}, | ||
"keyboardShortcuts": "Keyboard shortcuts", | ||
"@keyboardShortcuts": { | ||
"description": "Keyboard shortcuts tooltip" | ||
}, | ||
"newSnippet": "New {type} snippet", | ||
"@newSnippet": { | ||
"description": "New snippet for type", | ||
"placeholders": { | ||
"type": { | ||
"type": "String" | ||
} | ||
} | ||
}, | ||
"switchedToDartAndFlutter": "Switched to Dart {dartVersion} and Flutter {flutterVersion}", | ||
"@switchedToDartAndFlutter": { | ||
"description": "switchedToDartAndFlutter", | ||
"placeholders": { | ||
"dartVersion": { | ||
"type": "String" | ||
}, | ||
"flutterVersion": { | ||
"type": "String" | ||
} | ||
} | ||
}, | ||
"sharingGuide": "Sharing Guide", | ||
"@sharingGuide": { | ||
"description": "Sharing Guide button" | ||
}, | ||
"dartpadGithub": "DartPad on GitHub", | ||
"@dartpadGithub": { | ||
"description": "Dartpad on Github button" | ||
}, | ||
"command": "Command", | ||
"@command": { | ||
"description": "command table header" | ||
}, | ||
"keyboardShortcut": "Keyboard shortcut", | ||
"@keyboardShortcut": { | ||
"description": "Keyboard shortcut table header" | ||
}, | ||
"runtimeVersions": "Runtime versions", | ||
"@runtimeVersions": { | ||
"description": "Runtime versions" | ||
}, | ||
"basedOnDartAndFlutter": "Based on Dart SDK {dartVersion} and Flutter SDK {flutterVersion}", | ||
"@basedOnDartAndFlutter": { | ||
"description": "Based on Dart and Flutter title", | ||
"placeholders": { | ||
"dartVersion": { | ||
"type": "String" | ||
}, | ||
"flutterVersion": { | ||
"type": "String" | ||
} | ||
} | ||
}, | ||
"experimentsEnabled": "Experiments enabled: {experiments}", | ||
"@experimentsEnabled": { | ||
"description": "Experiments enabled", | ||
"placeholders": { | ||
"experiments": { | ||
"type": "String" | ||
} | ||
} | ||
}, | ||
"package": "Package", | ||
"@package": { | ||
"description": "Package table header" | ||
}, | ||
"version": "Version", | ||
"@version": { | ||
"description": "Version table header" | ||
}, | ||
"createNewSnippet": "Created new {type} snippet", | ||
"@createNewSnippet": { | ||
"description": "Create new snippet toast", | ||
"placeholders": { | ||
"type": { | ||
"type": "String" | ||
} | ||
} | ||
}, | ||
"codeCompletion": "Code completion", | ||
"@codeCompletion": { | ||
"description": "Code completion keyboard shortcut" | ||
}, | ||
"find": "Find", | ||
"@find": { | ||
"description": "Find keyboard shortcut" | ||
}, | ||
"findNext": "Find next", | ||
"@findNext": { | ||
"description": "Find next keyboard shortcut" | ||
}, | ||
"quickFixes": "Quick fixes", | ||
"@quickFixes": { | ||
"description": "Quick fixes keyboard shortcut" | ||
}, | ||
"reload": "Reload", | ||
"@reload": { | ||
"description": "Reload keyboard shortcut" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Generated by package:messages_builder. | ||
|
||
import 'package:flutter/services.dart'; | ||
import 'package:flutter/widgets.dart'; | ||
import 'package:flutter_localizations/flutter_localizations.dart'; | ||
import 'package:messages/package_intl_object.dart'; | ||
|
||
import 'en.g.dart'; | ||
|
||
class MessagesLocalizations { | ||
static Iterable<LocalizationsDelegate<dynamic>> localizationsDelegates = [ | ||
delegate, | ||
GlobalMaterialLocalizations.delegate, | ||
GlobalCupertinoLocalizations.delegate, | ||
GlobalWidgetsLocalizations.delegate, | ||
]; | ||
|
||
static LocalizationsDelegate<Messages> delegate = | ||
_MessagesLocalizationsDelegate(); | ||
|
||
static List<Locale> get supportedLocales { | ||
return Messages.knownLocales.map((e) { | ||
final split = e.split('_'); | ||
final code = split.length > 1 ? split[1] : null; | ||
return Locale(split.first, code); | ||
}).toList(); | ||
} | ||
|
||
static Messages? of(BuildContext context) => | ||
Localizations.of<Messages>(context, Messages); | ||
} | ||
|
||
class _MessagesLocalizationsDelegate extends LocalizationsDelegate<Messages> { | ||
@override | ||
bool isSupported(Locale locale) => | ||
Messages.knownLocales.contains(locale.toString()); | ||
|
||
@override | ||
Future<Messages> load(Locale locale) async { | ||
await messages.loadLocale(locale.toString()); | ||
return messages; | ||
} | ||
|
||
@override | ||
bool shouldReload(LocalizationsDelegate<Messages> old) => false; | ||
} | ||
|
||
extension MessagesLocalizationsExtension on BuildContext { | ||
Messages? get messagesLocalizations => MessagesLocalizations.of(this); | ||
} | ||
|
||
Messages messages = Messages(rootBundle.loadString, const OldIntlObject()); | ||
mosuem marked this conversation as resolved.
Show resolved
Hide resolved
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Shouldn't this be