Skip to content

Commit 5d8719a

Browse files
committed
test [skip ci]
1 parent 41673b7 commit 5d8719a

File tree

64 files changed

+4711
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+4711
-0
lines changed

.github/workflows/blank.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- release/v*
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
issues: write
12+
13+
jobs:
14+
semantic-release:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: 14
23+
- name: Semantic release
24+
id: semantic
25+
uses: cycjimmy/semantic-release-action@v4
26+
with:
27+
semantic_version: 17
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
outputs:
31+
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
32+
new_release_version: ${{ steps.semantic.outputs.new_release_version }}
33+
34+
deploy-upm:
35+
needs: semantic-release
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v3
39+
with:
40+
fetch-depth: 0
41+
- name: Create upm branch
42+
run: |
43+
git branch -d upm &> /dev/null || echo upm branch not found
44+
git subtree split -P "$PKG_ROOT" -b upm
45+
git checkout upm
46+
if [[ -d "Samples" ]]; then
47+
git mv Samples Samples~
48+
rm -f Samples.meta
49+
git config --global user.name 'github-bot'
50+
git config --global user.email '[email protected]'
51+
git commit -am "fix: Samples => Samples~"
52+
fi
53+
git push -f -u origin upm
54+
env:
55+
PKG_ROOT: Assets/Package
56+
- name: Create upm git tag
57+
if: needs.semantic-release.outputs.new_release_published == 'true'
58+
run: |
59+
git tag ${{ needs.semantic-release.outputs.new_release_version }} upm
60+
git push origin --tags

Assets/PackageLocale/Editor.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/PackageLocale/Editor/Icons.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
1.29 KB
Loading

Assets/PackageLocale/Editor/Icons/translate.png.meta

Lines changed: 127 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#if UNITY_EDITOR
2+
using SimpleLocalization.Runtime;
3+
using UnityEditor;
4+
using UnityEngine;
5+
6+
namespace OPAGames.SimpleLocalization.Editor
7+
{
8+
[InitializeOnLoad]
9+
public static class LocalizationEditorHelper
10+
{
11+
static LocalizationEditorHelper()
12+
{
13+
EditorApplication.playModeStateChanged += ApplyLanguageBeforePlay;
14+
}
15+
16+
private static void ApplyLanguageBeforePlay(PlayModeStateChange state)
17+
{
18+
if (state != PlayModeStateChange.EnteredPlayMode) return;
19+
var forceLanguage = EditorPrefs.GetBool("FineLocalization_UseEditorLanguage", false);
20+
if (!forceLanguage) return;
21+
var lang = EditorPrefs.GetString("FineLocalization_SelectedLanguage", "en-us");
22+
LocalizationManager.Language = lang;
23+
Debug.Log($"[Fine Localization] Force Language To: {lang} in Editor.");
24+
}
25+
}
26+
}
27+
#endif

Assets/PackageLocale/Editor/LocalizationEditorHelper.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/PackageLocale/Editor/Menu.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using SimpleLocalization.Runtime;
5+
using UnityEditor;
6+
using UnityEditor.Overlays;
7+
using UnityEngine;
8+
using UnityEngine.UIElements;
9+
10+
namespace OPAGames.SimpleLocalization.Editor.Menu
11+
{
12+
[Overlay(typeof(SceneView), "Fine Localization", true), Icon("Assets/SimpleLocalization/Editor/Icons/translate.png")]
13+
public class LocalizationOverlay : Overlay
14+
{
15+
private Texture icon { get; set; }
16+
private Texture2D _icon;
17+
18+
public override VisualElement CreatePanelContent()
19+
{
20+
var root = new VisualElement();
21+
22+
if (LocalizationManager.Dictionary.Count == 0)
23+
LocalizationManager.Read();
24+
25+
var langs = new List<string>(LocalizationManager.Dictionary.Keys
26+
.Where(k => !string.Equals(k, "KEY", StringComparison.OrdinalIgnoreCase)));
27+
var popupField = new PopupField<string>("Idioma", langs, LocalizationManager.Language);
28+
29+
popupField.style.minWidth = 160;
30+
root.Add(popupField);
31+
32+
var useEditorLanguage = EditorPrefs.GetBool("FineLocalization_UseEditorLanguage", false);
33+
popupField.SetEnabled(useEditorLanguage);
34+
35+
var toggle = new Toggle("Forçar linguagem do Editor") { value = useEditorLanguage };
36+
toggle.RegisterValueChangedCallback(evt =>
37+
{
38+
EditorPrefs.SetBool("FineLocalization_UseEditorLanguage", evt.newValue);
39+
popupField.SetEnabled(evt.newValue);
40+
});
41+
42+
root.Insert(0, toggle);
43+
44+
popupField.RegisterValueChangedCallback(evt =>
45+
{
46+
LocalizationManager.Language = evt.newValue;
47+
EditorPrefs.SetString("FineLocalization_SelectedLanguage", evt.newValue);
48+
});
49+
50+
return root;
51+
}
52+
53+
public override void OnCreated()
54+
{
55+
_icon = AssetDatabase.LoadAssetAtPath<Texture2D>("Assets/SimpleLocalization/Editor/Icons/translate.png");
56+
57+
if (_icon != null)
58+
{
59+
icon = _icon;
60+
}
61+
else
62+
{
63+
Debug.LogWarning("[Fine Localization] Ícone não encontrado.");
64+
}
65+
}
66+
}
67+
}

Assets/PackageLocale/Editor/Menu/LocalizationOverlay.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)