├── DocfxConf ├── guides │ ├── radmap.md │ ├── customLoader.md │ ├── res │ │ ├── font.png │ │ ├── pot.png │ │ ├── creator.png │ │ ├── i18nAudio.png │ │ ├── i18nImage.png │ │ ├── i18nTMPText.png │ │ ├── i18nText.png │ │ ├── potCreator.png │ │ ├── mediaCreator.png │ │ ├── i18nSpriteRenderer.png │ │ ├── rosettaRuntimeSetting.png │ │ └── scriptableObjectCollector.png │ ├── makeI18NRes │ │ ├── useI18NAttribute.md │ │ └── component │ │ │ ├── I18NImage.md │ │ │ ├── I18NAudio.md │ │ │ ├── I18NSpriteRenderer.md │ │ │ ├── I18NText.md │ │ │ └── I18NTMPText.md │ ├── toc.yml │ ├── gettingStarted.md │ ├── useCollectorAndCreator.md │ ├── loadAndUseOnRuntime.md │ └── translationFileTemplate.md ├── toc.yml ├── api │ └── .gitignore ├── .gitignore ├── custom_template │ ├── index.html.tmpl │ ├── partials │ │ ├── scripts.tmpl.partial │ │ └── affix.tmpl.partial │ ├── schemas │ │ └── Dashboard.schema.json │ ├── layout │ │ └── _master.tmpl │ ├── dashboard.html.liquid │ └── styles │ │ └── main.css ├── docfx.json └── index.md ├── UserSettings ├── Search.settings └── EditorUserSettings.asset ├── ProjectSettings ├── ProjectVersion.txt ├── ClusterInputManager.asset ├── NetworkManager.asset ├── VersionControlSettings.asset ├── TimeManager.asset ├── VFXManager.asset ├── EditorBuildSettings.asset ├── PresetManager.asset ├── AudioManager.asset ├── TagManager.asset ├── EditorSettings.asset ├── UnityConnectSettings.asset ├── PackageManagerSettings.asset ├── DynamicsManager.asset ├── MemorySettings.asset ├── NavMeshAreas.asset ├── Physics2DSettings.asset ├── GraphicsSettings.asset ├── QualitySettings.asset └── InputManager.asset ├── Assets ├── Plugins │ ├── Rosetta │ │ ├── Runtime │ │ │ ├── Common.meta │ │ │ ├── Component.meta │ │ │ ├── Common │ │ │ │ ├── Wav.cs.meta │ │ │ │ └── Wav.cs │ │ │ ├── I18NAttribute.cs.meta │ │ │ ├── Loader │ │ │ │ ├── PngLoader.cs.meta │ │ │ │ ├── PoLoader.cs.meta │ │ │ │ ├── WavLoader.cs.meta │ │ │ │ ├── FontLoader.cs.meta │ │ │ │ ├── MultiMediaLoader.cs.meta │ │ │ │ ├── LoaderBase.cs.meta │ │ │ │ ├── WavLoader.cs │ │ │ │ ├── FontLoader.cs │ │ │ │ ├── MultiMediaLoader.cs │ │ │ │ ├── PoLoader.cs │ │ │ │ ├── PngLoader.cs │ │ │ │ └── LoaderBase.cs │ │ │ ├── Component │ │ │ │ ├── I18NAudio.cs.meta │ │ │ │ ├── I18NImage.cs.meta │ │ │ │ ├── I18NTMPText.cs.meta │ │ │ │ ├── I18NText.cs.meta │ │ │ │ ├── I18NComponentBase.cs.meta │ │ │ │ ├── I18NSpriteRenderer.cs.meta │ │ │ │ ├── I18NImage.cs │ │ │ │ ├── I18NSpriteRenderer.cs │ │ │ │ ├── I18NAudio.cs │ │ │ │ ├── I18NComponentBase.cs │ │ │ │ ├── I18NText.cs │ │ │ │ └── I18NTMPText.cs │ │ │ ├── Loader.meta │ │ │ ├── Tests.meta │ │ │ ├── Utility.meta │ │ │ ├── Rosetta.Runtime.asmdef.meta │ │ │ ├── Tests │ │ │ │ ├── Rosetta.Runtime.Tests.asmdef.meta │ │ │ │ ├── LoaderTest.cs.meta │ │ │ │ ├── Rosetta.Runtime.Tests.asmdef │ │ │ │ └── LoaderTest.cs │ │ │ ├── LangFlag.cs.meta │ │ │ ├── Rosetta.cs.meta │ │ │ ├── I18NFileType.cs.meta │ │ │ ├── FolderPathAttribute.cs.meta │ │ │ ├── RosettaRuntimeSetting.cs.meta │ │ │ ├── Utility │ │ │ │ ├── IEnumerableExtension.cs.meta │ │ │ │ └── IEnumerableExtension.cs │ │ │ ├── FolderPathAttribute.cs │ │ │ ├── Rosetta.Runtime.asmdef │ │ │ ├── I18NFileType.cs │ │ │ ├── RosettaRuntimeSetting.cs │ │ │ ├── I18NAttribute.cs │ │ │ └── LangFlag.cs │ │ ├── Editor │ │ │ ├── Creator │ │ │ │ ├── MediaCreator.cs.meta │ │ │ │ ├── PotCreator.cs.meta │ │ │ │ ├── CreatorBase.cs.meta │ │ │ │ ├── CreatorBase.cs │ │ │ │ ├── PotCreator.cs │ │ │ │ └── MediaCreator.cs │ │ │ ├── Collector │ │ │ │ ├── PrefabCollector.cs.meta │ │ │ │ ├── SceneCollector.cs.meta │ │ │ │ ├── PrefabCollectorBase.cs.meta │ │ │ │ ├── ScriptableObjectCollector.cs.meta │ │ │ │ ├── CollectorBase.cs.meta │ │ │ │ ├── PrefabCollector.cs │ │ │ │ ├── SceneCollector.cs │ │ │ │ ├── CollectorBase.cs │ │ │ │ ├── PrefabCollectorBase.cs │ │ │ │ └── ScriptableObjectCollector.cs │ │ │ ├── Collector.meta │ │ │ ├── Creator.meta │ │ │ ├── Custom.meta │ │ │ ├── Tests.meta │ │ │ ├── Custom │ │ │ │ ├── Creator.meta │ │ │ │ ├── Collector.meta │ │ │ │ ├── Component.meta │ │ │ │ ├── Property.meta │ │ │ │ ├── Component │ │ │ │ │ ├── I18NTextEditor.cs.meta │ │ │ │ │ ├── I18NImageEditor.cs.meta │ │ │ │ │ ├── I18NTMPTextEditor.cs.meta │ │ │ │ │ ├── I18NTextEditor.cs │ │ │ │ │ ├── I18NTMPTextEditor.cs │ │ │ │ │ └── I18NImageEditor.cs │ │ │ │ ├── Creator │ │ │ │ │ ├── CreatorBaseEditor.cs.meta │ │ │ │ │ └── CreatorBaseEditor.cs │ │ │ │ ├── Property │ │ │ │ │ ├── FolderPathDrawer.cs.meta │ │ │ │ │ └── FolderPathDrawer.cs │ │ │ │ ├── RosettaRuntimeSettingEditor.cs.meta │ │ │ │ ├── Collector │ │ │ │ │ ├── ScriptableObjectCollectorEditor.cs.meta │ │ │ │ │ └── ScriptableObjectCollectorEditor.cs │ │ │ │ └── RosettaRuntimeSettingEditor.cs │ │ │ ├── Rosetta.Editor.asmdef.meta │ │ │ ├── Tests │ │ │ │ ├── Rosetta.Editor.Tests.asmdef.meta │ │ │ │ ├── CreatorTest.cs.meta │ │ │ │ ├── Rosetta.Editor.Tests.asmdef │ │ │ │ └── CreatorTest.cs │ │ │ └── Rosetta.Editor.asmdef │ │ ├── Editor.meta │ │ └── Runtime.meta │ └── Rosetta.meta └── Plugins.meta ├── Res └── Rosetta.png ├── LICENSE ├── .gitignore ├── README.md ├── Packages ├── manifest.json └── packages-lock.json └── .gitattributes /DocfxConf/guides/radmap.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /DocfxConf/guides/customLoader.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /UserSettings/Search.settings: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /DocfxConf/toc.yml: -------------------------------------------------------------------------------- 1 | - name: Guides 2 | href: guides/ 3 | - name: API Documentation 4 | href: api/ -------------------------------------------------------------------------------- /DocfxConf/api/.gitignore: -------------------------------------------------------------------------------- 1 | ############### 2 | # temp file # 3 | ############### 4 | *.yml 5 | .manifest 6 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2022.3.5f1c1 2 | m_EditorVersionWithRevision: 2022.3.5f1c1 (8357566ed26e) 3 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Common.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 55c081e4648e4cd1b74435056551c7c1 3 | timeCreated: 1566614340 -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Component.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1dae67744ee64937adb3ca74bd38029c 3 | timeCreated: 1566616923 -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Common/Wav.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dbca96b42930467c9dd9b203bd0a0899 3 | timeCreated: 1566614358 -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/I18NAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fd10464220db46a7af3f228f1d157a97 3 | timeCreated: 1566614046 -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Loader/PngLoader.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8ec1d3210fcb449180a7425fe9c263de 3 | timeCreated: 1566614291 -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Loader/PoLoader.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 05176e72c25b4c67915bd33bca90a43d 3 | timeCreated: 1566614472 -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Loader/WavLoader.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e0b600a9807843ad93ff2ebb9babf6f5 3 | timeCreated: 1566614312 -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Creator/MediaCreator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: faa6f49eaf624e66804635955832ff1f 3 | timeCreated: 1566652939 -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Creator/PotCreator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 039aab71251b4257a415ce7a75127cfb 3 | timeCreated: 1566654550 -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Component/I18NAudio.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4a7153d0abd448d7a446bf29f6963863 3 | timeCreated: 1566619000 -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Component/I18NImage.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 90575c44986c42bfb878ea2d71ee4e65 3 | timeCreated: 1566619054 -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Component/I18NTMPText.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3291a6717d7a43b68979f4f179012d99 3 | timeCreated: 1566618962 -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Component/I18NText.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d664197d13b24187b143f5a0bca025ee 3 | timeCreated: 1566618480 -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Loader/FontLoader.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c14b37039d4448b6bac74fe397df7d53 3 | timeCreated: 1566614234 -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Collector/PrefabCollector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 587d2553a14549219e8f402c69956a17 3 | timeCreated: 1566654215 -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Collector/SceneCollector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2b27ec5c366942678df5f03e08a5de41 3 | timeCreated: 1566654465 -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Loader/MultiMediaLoader.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 566e5e83cc304274b7416a02a65931b1 3 | timeCreated: 1566615134 -------------------------------------------------------------------------------- /Res/Rosetta.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:32b57faefd572989fb876f7f44837356df2f18c919bc918310bf94f17b1bb0f1 3 | size 174324 4 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Collector/PrefabCollectorBase.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 68c2202931bb4ac5a8ea58807dda47de 3 | timeCreated: 1566654249 -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Component/I18NComponentBase.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c1b65b5c917f428d9c5c215198ea485c 3 | timeCreated: 1566616941 -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Component/I18NSpriteRenderer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fbf93b8ecb89481bbc201e3fd7cf16b7 3 | timeCreated: 1566619073 -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Collector/ScriptableObjectCollector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a59ec2d19522493280f6c733af23dca6 3 | timeCreated: 1566654497 -------------------------------------------------------------------------------- /DocfxConf/.gitignore: -------------------------------------------------------------------------------- 1 | ############### 2 | # folder # 3 | ############### 4 | /**/DROP/ 5 | /**/TEMP/ 6 | /**/packages/ 7 | /**/bin/ 8 | /**/obj/ 9 | _site 10 | -------------------------------------------------------------------------------- /DocfxConf/guides/res/font.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:74bdfdfd85d7b69f1e1f64fb8acf99a3ee7309fa1dfa814238269680ff0fc109 3 | size 8538 4 | -------------------------------------------------------------------------------- /DocfxConf/guides/res/pot.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:1e08f5817047f413fe0ff575181b082cd1011430f6d282f426c9dd217390ce90 3 | size 66685 4 | -------------------------------------------------------------------------------- /DocfxConf/guides/res/creator.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:7b49986c0b6035a184a94b8c36a9c035e2c245507f7eb82f3526ef8f54ae1c20 3 | size 25470 4 | -------------------------------------------------------------------------------- /DocfxConf/guides/res/i18nAudio.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:d78b362e8983eb98df6126eaedf65563a8079a5c7abda5751bfb57b5d9569100 3 | size 47855 4 | -------------------------------------------------------------------------------- /DocfxConf/guides/res/i18nImage.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:c221f003adf34459444ef08e5871f434f2c48b31cd1f73a5f8b32aee311f67a2 3 | size 43635 4 | -------------------------------------------------------------------------------- /DocfxConf/guides/res/i18nTMPText.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:059e9b1e6bc11d177a96a75949634440de7d25f49e71fd13a9b625d301f8e60d 3 | size 61735 4 | -------------------------------------------------------------------------------- /DocfxConf/guides/res/i18nText.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:a8c137a11ab8507498e279b933c326999481dea132ed040d779062a21d2d8e65 3 | size 49924 4 | -------------------------------------------------------------------------------- /DocfxConf/guides/res/potCreator.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:26a62faea7ae60b6af4459d4c588e4f98c2b6b6fb0014c5037d2662f8081257d 3 | size 23493 4 | -------------------------------------------------------------------------------- /DocfxConf/guides/res/mediaCreator.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:3b37a01d9554ce9db02696d6fd5cb78068ea5c39d17e9822d776298adacf4f28 3 | size 27411 4 | -------------------------------------------------------------------------------- /DocfxConf/guides/res/i18nSpriteRenderer.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:bbef7b2a10c320b558da47a3516ffe935fe6fe558888908a8c285026fe7c2492 3 | size 41504 4 | -------------------------------------------------------------------------------- /DocfxConf/guides/res/rosettaRuntimeSetting.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:357f91504dcb2af5d47f8699b12c0fa350349dc0e7db91490c7b815bda302622 3 | size 15511 4 | -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /DocfxConf/guides/res/scriptableObjectCollector.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:50d4cadbdd5c05a680c314db882c267a8cc1f65042070f0efb0c2f452cefa8ed 3 | size 17532 4 | -------------------------------------------------------------------------------- /Assets/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 45b7316b8dcc407409013a4c2d7b655a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 11a25812825275a4a829c359489183c3 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 423aee578ad99d24eb6b120b81e021a0 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c4a962bc390f3164dae4e4264a8b4949 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Collector.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9026c6b39d9c79f4590355dcf7478227 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Creator.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5351055ff3b213141b022963670c397d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Custom.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5cb302944d2acf148ba0f985ca5a5db0 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Tests.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4b4228c1aefb5a540ae82f40df279eb1 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Loader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f9ce6d38c6b8748469a67dacec6c4a27 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Tests.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7100e2bbc84388144896e6313bd48e5d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Utility.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d3749bbb9244b754ca0646128e9e2354 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Custom/Creator.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f17650341256229438b7ee1fe9828179 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Rosetta.Editor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0d1059542e9c5084883f3618470ef902 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Rosetta.Runtime.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 77e53d059b5e3284ea1d225ac448832e 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Custom/Collector.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 33172544199a01a4aa406b9c1cde0de7 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Custom/Component.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3a765c99dae37874aa4cc607bbfb7de7 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Custom/Property.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a9e7640c48f6b3946b2c179e241b6364 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Tests/Rosetta.Editor.Tests.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a7af5cd6c397865439e33cd50e4b0704 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Tests/Rosetta.Runtime.Tests.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: debf19e54af50654d96af0dbbb8e119d 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /ProjectSettings/VersionControlSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!890905787 &1 4 | VersionControlSettings: 5 | m_ObjectHideFlags: 0 6 | m_Mode: Visible Meta Files 7 | m_CollabEditorSettings: 8 | inProgressEnabled: 1 9 | -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.1 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/LangFlag.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 803a7028352078d48a6999a141988103 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Rosetta.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b077f39c30148f54d8985e7563849aef 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/I18NFileType.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4197b7741f9efd648bc50a69fc2821e6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Creator/CreatorBase.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1b8387e618fe1184ab0fb8798884ca10 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Tests/CreatorTest.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b4bb23fdc9bf82245be0994cc7e65f18 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/FolderPathAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b17eac000eac7744b8af85242ea6cfff 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Loader/LoaderBase.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 717c5ff992ce565499ce016bd620fde6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Tests/LoaderTest.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d2c64f4ec198fa740a0816d571f81de3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Collector/CollectorBase.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4b0164d1b87790d4b8ad010ba9efa564 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/RosettaRuntimeSetting.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c610b1b8db6095843b886c2a5fea2a89 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_RenderPipeSettingsPath: 10 | m_FixedTimeStep: 0.016666668 11 | m_MaxDeltaTime: 0.05 12 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Custom/Component/I18NTextEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2b44f5f6c40a86a4c99b5915612a5715 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Utility/IEnumerableExtension.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 369b50be2a66016488ea83bd14610881 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: 8 | - enabled: 1 9 | path: Assets/Scenes/SampleScene.unity 10 | guid: 2cda990e2423bbf4892e6590ba056729 11 | m_configObjects: {} 12 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Custom/Component/I18NImageEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8dbc206bf279f8545bd5d8591f0993ec 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Custom/Component/I18NTMPTextEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 27749c3d15e3fb04b80d3c709f20f6b3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Custom/Creator/CreatorBaseEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 646b2cc529ec2a04fb43d1c190c748cd 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Custom/Property/FolderPathDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9e9e608183d21cb4fbc293dade25775d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Custom/RosettaRuntimeSettingEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 83e3cac232c12494f86a802d1a84747f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Custom/Collector/ScriptableObjectCollectorEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6a273296703056b4489accef0dfa76f9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Utility/IEnumerableExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Rosetta.Utils 5 | { 6 | public static class IEnumerableExtension 7 | { 8 | public static void ForEach(this IEnumerable dict, Action callback) 9 | { 10 | foreach (var pair in dict) callback?.Invoke(pair); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/FolderPathAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace Rosetta.Runtime 5 | { 6 | /// 7 | /// The substitute to Odin's [FolderPath] Attribute. 8 | /// 9 | [AttributeUsage(AttributeTargets.Field)] 10 | public class FolderPathAttribute : PropertyAttribute 11 | { 12 | public FolderPathAttribute() { } 13 | } 14 | } -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Rosetta.Runtime.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Rosetta.Runtime", 3 | "references": [ 4 | "Unity.TextMeshPro" 5 | ], 6 | "optionalUnityReferences": [], 7 | "includePlatforms": [], 8 | "excludePlatforms": [], 9 | "allowUnsafeCode": false, 10 | "overrideReferences": false, 11 | "precompiledReferences": [], 12 | "autoReferenced": true, 13 | "defineConstraints": [] 14 | } -------------------------------------------------------------------------------- /ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | m_DefaultList: 7 | - type: 8 | m_NativeTypeID: 20 9 | m_ManagedTypePPtr: {fileID: 0} 10 | m_ManagedTypeFallback: 11 | defaultPresets: 12 | - m_Preset: {fileID: 2655988077585873504, guid: bfcfc320427f8224bbb7a96f3d3aebad, 13 | type: 2} 14 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/I18NFileType.cs: -------------------------------------------------------------------------------- 1 | namespace Rosetta.Runtime 2 | { 3 | /// 4 | /// I18N file type. Each file type has a corresponding loader. 5 | /// 6 | public enum I18NFileType 7 | { 8 | Po, 9 | Png, 10 | Wav, 11 | Font, 12 | 13 | // TODO: Waiting for support 14 | TMPFont, 15 | Mo, 16 | Json, 17 | Xml, 18 | Csv 19 | } 20 | } -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | m_Volume: 1 7 | Rolloff Scale: 1 8 | Doppler Factor: 1 9 | Default Speaker Mode: 2 10 | m_SampleRate: 0 11 | m_DSPBufferSize: 1024 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_AmbisonicDecoderPlugin: 16 | m_DisableAudio: 0 17 | m_VirtualizeEffects: 1 18 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Tests/Rosetta.Runtime.Tests.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Rosetta.Runtime.Tests", 3 | "references": [ 4 | "Rosetta.Runtime" 5 | ], 6 | "optionalUnityReferences": [ 7 | "TestAssemblies" 8 | ], 9 | "includePlatforms": [], 10 | "excludePlatforms": [], 11 | "allowUnsafeCode": false, 12 | "overrideReferences": false, 13 | "precompiledReferences": [], 14 | "autoReferenced": true, 15 | "defineConstraints": [] 16 | } -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Rosetta.Editor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Rosetta.Editor", 3 | "references": [ 4 | "Rosetta.Runtime", 5 | "Unity.TextMeshPro" 6 | ], 7 | "optionalUnityReferences": [], 8 | "includePlatforms": [ 9 | "Editor" 10 | ], 11 | "excludePlatforms": [], 12 | "allowUnsafeCode": false, 13 | "overrideReferences": false, 14 | "precompiledReferences": [], 15 | "autoReferenced": true, 16 | "defineConstraints": [] 17 | } -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Tests/Rosetta.Editor.Tests.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Rosetta.Editor.Tests", 3 | "references": [ 4 | "Rosetta.Editor" 5 | ], 6 | "optionalUnityReferences": [ 7 | "TestAssemblies" 8 | ], 9 | "includePlatforms": [ 10 | "Editor" 11 | ], 12 | "excludePlatforms": [], 13 | "allowUnsafeCode": false, 14 | "overrideReferences": false, 15 | "precompiledReferences": [], 16 | "autoReferenced": true, 17 | "defineConstraints": [] 18 | } -------------------------------------------------------------------------------- /DocfxConf/guides/makeI18NRes/useI18NAttribute.md: -------------------------------------------------------------------------------- 1 | # 使用 I18N Attribute 2 | 3 | Rosetta 总共提供以下几种 I18N Attribute: 4 | * I18NClass 5 | * I18NString 6 | * I18NAudio 7 | * I18NImage 8 | 9 | ### I18NClass 10 | `I18NClass` 用来标记一个类是否需要进行 I18N 处理。Rosetta 会先从程序集里查找所有所有有 `I18NClass` 标记的类。然后再进一步扫描这些类的字段(field)。 11 | 12 | ### I18NString 13 | 14 | `I18NString` 用来标记一个类的字段是否为一个 I18N 字符串。 15 | 16 | ### I18NAudio 17 | 18 | `I18NAudio` 用来标记一个类的字段是否为一个 I18N 音频。 19 | 20 | ### I18NImage 21 | 22 | `I18NAudio` 用来标记一个类的字段是否为一个 I18N 图片。 23 | 24 | 25 | 需要注意的是 `I18NString`/`I18NAudio`/`I18NAudio` 三者均可以传入一个 comment 参数。其值会在生成 Pot 文档时用作 "#." 注释。 26 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/RosettaRuntimeSetting.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace Rosetta.Runtime 6 | { 7 | [CreateAssetMenu(fileName = "RosettaRuntimeSetting", menuName = "Rosetta/RuntimeSetting")] 8 | [Serializable] 9 | public class RosettaRuntimeSetting : ScriptableObject 10 | { 11 | public List DefaultI18NSpaces = new List { "UI" }; 12 | 13 | public LangFlag DevLocale = LangFlag.EN; 14 | 15 | [HideInInspector] public LangFlag Locale = LangFlag.EN; 16 | 17 | public I18NFileType TextFileType; 18 | } 19 | } -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Collector/PrefabCollector.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | namespace Rosetta.Editor.Collector 5 | { 6 | public class PrefabCollector : PrefabCollectorBase 7 | { 8 | public List PrefabList = new List(); 9 | 10 | public override void Collect(string space) 11 | { 12 | PrefabList.ForEach(prefab => 13 | { 14 | GameObjects = new List{prefab}; 15 | PrefixName = $"Scene[{prefab.name}]:"; 16 | base.Collect(space); 17 | }); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Custom/Collector/ScriptableObjectCollectorEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using Rosetta.Editor.Collector; 4 | 5 | namespace Rosetta.Editor.Custom.Collector 6 | { 7 | [CustomEditor(typeof(ScriptableObjectCollector))] 8 | public class ScriptableObjectCollectorEditor : UnityEditor.Editor 9 | { 10 | public override void OnInspectorGUI() 11 | { 12 | base.OnInspectorGUI(); 13 | if (GUILayout.Button("Refresh")) 14 | (target as ScriptableObjectCollector)?.Refresh(); 15 | serializedObject.ApplyModifiedProperties(); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /DocfxConf/custom_template/index.html.tmpl: -------------------------------------------------------------------------------- 1 | {{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}} 2 | {{!include(/^styles/.*/)}} 3 | {{!include(/^fonts/.*/)}} 4 | {{!include(favicon.ico)}} 5 | {{!include(logo.svg)}} 6 | 7 | 8 | 9 | {{>partials/head}} 10 | 11 |
12 |
13 | {{>partials/navbar}} 14 |
15 | {{{conceptual}}} 16 | {{>partials/footer}} 17 |
18 | {{>partials/scripts}} 19 | 20 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Custom/Component/I18NTextEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using Rosetta.Runtime.Component; 3 | 4 | namespace Rosetta.Editor.Component.Custom 5 | { 6 | [CustomEditor(typeof(I18NText))] 7 | public class I18NTextEditor : UnityEditor.Editor 8 | { 9 | public override void OnInspectorGUI() 10 | { 11 | base.OnInspectorGUI(); 12 | var showFont = serializedObject.FindProperty("IsVirtualFont"); 13 | EditorGUILayout.PropertyField(showFont); 14 | if (showFont.boolValue) EditorGUILayout.PropertyField(serializedObject.FindProperty("VirtualFontName")); 15 | serializedObject.ApplyModifiedProperties(); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Custom/Component/I18NTMPTextEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using Rosetta.Runtime.Component; 3 | 4 | namespace Rosetta.Editor.Component.Custom 5 | { 6 | [CustomEditor(typeof(I18NtmpText))] 7 | public class I18NTMPTextEditor : UnityEditor.Editor 8 | { 9 | public override void OnInspectorGUI() 10 | { 11 | base.OnInspectorGUI(); 12 | var showFont = serializedObject.FindProperty("IsVirtualFont"); 13 | EditorGUILayout.PropertyField(showFont); 14 | if (showFont.boolValue) EditorGUILayout.PropertyField(serializedObject.FindProperty("VirtualFontName")); 15 | serializedObject.ApplyModifiedProperties(); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /UserSettings/EditorUserSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!162 &1 4 | EditorUserSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_ConfigSettings: 8 | vcSharedLogLevel: 9 | value: 0d5e400f0650 10 | flags: 0 11 | m_VCAutomaticAdd: 1 12 | m_VCDebugCom: 0 13 | m_VCDebugCmd: 0 14 | m_VCDebugOut: 0 15 | m_SemanticMergeMode: 2 16 | m_DesiredImportWorkerCount: 2 17 | m_StandbyImportWorkerCount: 2 18 | m_IdleImportWorkerShutdownDelay: 60000 19 | m_VCShowFailedCheckout: 1 20 | m_VCOverwriteFailedCheckoutAssets: 1 21 | m_VCProjectOverlayIcons: 1 22 | m_VCHierarchyOverlayIcons: 1 23 | m_VCOtherOverlayIcons: 1 24 | m_VCAllowAsyncUpdate: 1 25 | m_ArtifactGarbageCollection: 1 26 | -------------------------------------------------------------------------------- /DocfxConf/guides/makeI18NRes/component/I18NImage.md: -------------------------------------------------------------------------------- 1 | # I18NImage 组件 2 | 3 | I18NImage 是用来标记一个 GameObject 上存在需要 I18N 处理的 [Image](https://docs.unity3d.com/Manual/script-Image.html) 的组件。 4 | 5 | 在运行时,I18NImage 组件通过订阅 Rosetta 的 [LocaleChanged](https://molingyu.github.io/RosettaDocs/api/Rosetta.Runtime.Rosetta.html#events) 事件,从而在切换语言后自动读取并替换当前 `GameObject` 的 `Image` 组件内 Source Image(`Sprite`) 字段为当前语言对应的 I18N 图像资源。 6 | 7 | ![I18NImage](../../res/i18nImage.png) 8 | 9 | ## 属性 10 | |Name|Description| 11 | |---|:---| 12 | |I18N Comment|多语言资源注释。该注释会随着当前的 I18N 音频资源的模板文件一同交给多语言工作者。| 13 | |I18N Space|该 I18N Image 资源所属的域,关于域的说明请参阅 [使用 Collector 和 Creator: 域](https://molingyu.github.io/RosettaDocs/guides/useCollectorAndCreator.html#space--%E5%9F%9F)| 14 | |Res Name|多语言资源的资源名。在运行时,Rosetta 会通过该值在对应的多语言文件夹内读取同名的文件。| -------------------------------------------------------------------------------- /DocfxConf/guides/makeI18NRes/component/I18NAudio.md: -------------------------------------------------------------------------------- 1 | # I18NAudio 组件 2 | 3 | I18NAudio 是用来标记一个 GameObject 上存在需要 I18N 处理的 [AudioSource](https://docs.unity3d.com/Manual/class-AudioSource.html) 的组件。 4 | 5 | 在运行时,I18NAudio 组件通过订阅 Rosetta 的 [LocaleChanged](https://molingyu.github.io/RosettaDocs/api/Rosetta.Runtime.Rosetta.html#events) 事件,从而在切换语言后自动读取并替换当前 `GameObject` 的 `AudioSource` 组件内 `AudioClip` 字段为当前语言对应的 I18N 音频资源。 6 | 7 | ![I18NAudio](../../res/i18nAudio.png) 8 | 9 | 10 | ## 属性 11 | |Name|Description| 12 | |---|:---| 13 | |I18N Comment|多语言资源注释。该注释会随着当前的 I18N 音频资源的模板文件一同交给多语言工作者。| 14 | |I18N Space|该 I18N Audio 资源所属的域,关于域的说明请参阅 [使用 Collector 和 Creator: 域](https://molingyu.github.io/RosettaDocs/guides/useCollectorAndCreator.html#space--%E5%9F%9F)| 15 | |Res Name|多语言资源的资源名。在运行时,Rosetta 会通过该值在对应的多语言文件夹内读取同名的文件。| -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 7 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 2 10 | m_DefaultBehaviorMode: 1 11 | m_PrefabRegularEnvironment: {fileID: 0} 12 | m_PrefabUIEnvironment: {fileID: 0} 13 | m_SpritePackerMode: 4 14 | m_SpritePackerPaddingPower: 1 15 | m_EtcTextureCompressorBehavior: 1 16 | m_EtcTextureFastCompressor: 1 17 | m_EtcTextureNormalCompressor: 2 18 | m_EtcTextureBestCompressor: 4 19 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef 20 | m_ProjectGenerationRootNamespace: Assets 21 | m_CollabEditorSettings: 22 | inProgressEnabled: 1 23 | m_EnableTextureStreamingInPlayMode: 1 24 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Tests/CreatorTest.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using NUnit.Framework; 3 | using UnityEngine.TestTools; 4 | 5 | namespace Rosetta.Runtime.Tests 6 | { 7 | public class CreatorTest 8 | { 9 | // A Test behaves as an ordinary method 10 | [Test] 11 | public void CreatorTestSimplePasses() 12 | { 13 | // Use the Assert class to test conditions 14 | } 15 | 16 | // A UnityTest behaves like a coroutine in Play Mode. In Edit Mode you can use 17 | // `yield return null;` to skip a frame. 18 | [UnityTest] 19 | public IEnumerator CreatorTestWithEnumeratorPasses() 20 | { 21 | // Use the Assert class to test conditions. 22 | // Use yield to skip a frame. 23 | yield return null; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Tests/LoaderTest.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using NUnit.Framework; 3 | using UnityEngine.TestTools; 4 | 5 | namespace Rosetta.Runtime.Tests 6 | { 7 | public class LoaderTest 8 | { 9 | // A Test behaves as an ordinary method 10 | [Test] 11 | public void LoaderTestSimplePasses() 12 | { 13 | // Use the Assert class to test conditions 14 | } 15 | 16 | // A UnityTest behaves like a coroutine in Play Mode. In Edit Mode you can use 17 | // `yield return null;` to skip a frame. 18 | [UnityTest] 19 | public IEnumerator LoaderTestWithEnumeratorPasses() 20 | { 21 | // Use the Assert class to test conditions. 22 | // Use yield to skip a frame. 23 | yield return null; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /DocfxConf/guides/makeI18NRes/component/I18NSpriteRenderer.md: -------------------------------------------------------------------------------- 1 | # I18NSpriteRenderer 组件 2 | 3 | I18NSpriteRenderer 是用来标记一个 GameObject 上存在需要 I18N 处理的 [SpriteRenderer](https://docs.unity3d.com/Manual/class-SpriteRenderer.html) 的组件。 4 | 5 | 在运行时,I18NSpriteRenderer 组件通过订:阅 Rosetta 的 [LocaleChanged](https://molingyu.github.io/RosettaDocs/api/Rosetta.Runtime 6 | .Rosetta.html#events) 事件,从而在切换语言后自动读取并替换当前 `GameObject` 的 `SpriteRenderer` 组件内 `Sprite` 字段为当前语言对应的 I18N 图像资源。 7 | 8 | ![I18NSpriteRenderer](../../res/i18nSpriteRenderer.png) 9 | 10 | ## 属性 11 | |Name|Description| 12 | |---|:---| 13 | |I18N Comment|多语言资源注释。该注释会随着当前的 I18N 音频资源的模板文件一同交给多语言工作者。| 14 | |I18N Space|该 I18N SpriteRenderer 资源所属的域,关于域的说明请参阅 [使用 Collector 和 Creator: 域](https://molingyu.github.io/RosettaDocs/guides/useCollectorAndCreator.html#space--%E5%9F%9F)| 15 | |Res Name|多语言资源的资源名。在运行时,Rosetta 会通过该值在对应的多语言文件夹内读取同名的文件。| -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Collector/SceneCollector.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using UnityEditor; 4 | using UnityEditor.SceneManagement; 5 | 6 | namespace Rosetta.Editor.Collector 7 | { 8 | public class SceneCollector : PrefabCollectorBase 9 | { 10 | public List SceneList = new(); 11 | 12 | public override void Collect(string space) 13 | { 14 | EditorSceneManager.SaveOpenScenes(); 15 | SceneList.ForEach(sceneAsset => 16 | { 17 | var scene = EditorSceneManager.OpenScene(AssetDatabase.GetAssetPath(sceneAsset), OpenSceneMode.Single); 18 | GameObjects = scene.GetRootGameObjects().ToList(); 19 | PrefixName = $"Scene[{scene.name}]:"; 20 | base.Collect(space); 21 | }); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /DocfxConf/guides/makeI18NRes/component/I18NText.md: -------------------------------------------------------------------------------- 1 | # I18NText 组件 2 | 3 | I18NText 是用来标记一个 GameObject 上存在需要 I18N 处理的 [Text](https://docs.unity3d.com/Manual/script-Text.html) 的组件。 4 | 5 | 在运行时,I18NText 组件通过订阅 Rosetta 的 [LocaleChanged](https://molingyu.github.io/RosettaDocs/api/Rosetta.Runtime.Rosetta.html#events) 事件,从而在切换语言后自动读取并替换当前 `GameObject` 的 `Text` 组件内 `Text` 字段为当前语言对应的 I18N 文本资源。根据设置不同,可能还会替换 `font` 字段。 6 | 7 | ![I18NText](../../res/i18nText.png) 8 | 9 | ## 属性 10 | |Name|Description| 11 | |---|:---| 12 | |I18N Comment|多语言资源注释。该注释会随着当前的 I18N 音频资源的模板文件一同交给多语言工作者。| 13 | |I18N Space|该 I18N Text 资源所属的域,关于域的说明请参阅 [使用 Collector 和 Creator: 域](https://molingyu.github.io/RosettaDocs/guides/useCollectorAndCreator.html#space--%E5%9F%9F)| 14 | |Is Virtual Font|是否启用虚拟字体设定。当启用后,Rosetta 加载时会先去根据 `Virtual Font Name` 读取虚拟字体配置文件,然后获取对应语言的真实字体文件的名称后再加载并应用。| 15 | |Virtual Font Name*|虚拟字体配置文件的名称。| 16 | 17 | *注: 只有当 `IsVirtualFont` 为真时,该字段才有用。* -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Loader/WavLoader.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using Rosetta.Runtime.Common; 3 | using UnityEngine; 4 | 5 | namespace Rosetta.Runtime.Loader 6 | { 7 | /// 8 | /// Load `.wav` file in runtime and return a `AudioClip` object. 9 | /// 10 | public class WavLoader : LoaderBase 11 | { 12 | 13 | public override T Load(string space, string filename, LangFlag? flag = null) 14 | { 15 | LoadBase(Path.Combine("res", "audio", space, filename), flag ?? Rosetta.Locale); 16 | ExtensionName = "wav"; 17 | var wav = new Wav(LoadFile()); 18 | var clip = AudioClip.Create($"{filename}_{(flag ?? Rosetta.Locale).ToString().ToLower()}", 19 | wav.SampleCount, 1, wav.Frequency, false); 20 | clip.SetData(wav.LeftChannel, 0); 21 | return (T) (object) clip; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Custom/Component/I18NImageEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using UnityEngine.UI; 4 | using Rosetta.Runtime.Component; 5 | 6 | namespace Rosetta.Editor.Component.Custom 7 | { 8 | [CustomEditor(typeof(I18NImage))] 9 | public class I18NImageEditor : UnityEditor.Editor 10 | { 11 | public override void OnInspectorGUI() 12 | { 13 | base.OnInspectorGUI(); 14 | if (EditorApplication.isPlaying) return; 15 | TextureImporter textureImporter = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath( 16 | (target as GameObject)?.GetComponent().sprite.texture)) as TextureImporter; 17 | if (textureImporter != null && !textureImporter.isReadable) 18 | EditorGUILayout.HelpBox("The Image source sprite is not readable.", UnityEditor.MessageType.Error); 19 | serializedObject.ApplyModifiedProperties(); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /DocfxConf/custom_template/partials/scripts.tmpl.partial: -------------------------------------------------------------------------------- 1 | {{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 18 | -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 1 7 | m_Enabled: 1 8 | m_TestMode: 0 9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events 10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events 11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com 12 | m_TestInitMode: 0 13 | CrashReportingSettings: 14 | m_EventUrl: https://perf-events.cloud.unity3d.com 15 | m_Enabled: 0 16 | m_LogBufferSize: 10 17 | m_CaptureEditorExceptions: 1 18 | UnityPurchasingSettings: 19 | m_Enabled: 0 20 | m_TestMode: 0 21 | UnityAnalyticsSettings: 22 | m_Enabled: 0 23 | m_TestMode: 0 24 | m_InitializeOnStartup: 1 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /DocfxConf/guides/toc.yml: -------------------------------------------------------------------------------- 1 | - name: 基础 2 | items: 3 | - name: 起步 4 | href: gettingStarted.md 5 | - name: 标记 I18N 资源 6 | items: 7 | - name: 使用 I18N Attribute 8 | href: makeI18NRes/useI18NAttribute.md 9 | - name: 使用 I18N Component 10 | items: 11 | - name: I18NAudio 12 | href: makeI18NRes/component/I18NAudio.md 13 | - name: I18NImage 14 | href: makeI18NRes/component/I18NImage.md 15 | - name: I18NSpriteRenderer 16 | href: makeI18NRes/component/I18NSpriteRenderer.md 17 | - name: I18NText 18 | href: makeI18NRes/component/I18NText.md 19 | - name: I18NTMPText 20 | href: makeI18NRes/component/I18NTMPText.md 21 | - name: 使用 Collector 和 Creator 22 | href: useCollectorAndCreator.md 23 | - name: 翻译文件模板 24 | href: translationFileTemplate.md 25 | - name: 运行时加载和使用 26 | href: loadAndUseOnRuntime.md 27 | - name: 高级开发 28 | items: 29 | - name: 自定义 Loader 30 | href: customLoader.md 31 | - name: 开发路线图 32 | href: radmap.md -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Component/I18NImage.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UI; 3 | 4 | namespace Rosetta.Runtime.Component 5 | { 6 | /// 7 | /// Marking the current Image component requires I18N. 8 | /// 9 | [AddComponentMenu("Rosetta/I18NImage")] 10 | [RequireComponent(typeof(Image))] 11 | [HelpURL("https://molingyu.github.io/RosettaDocs/guides/makeI18NRes/component/I18NImage.html")] 12 | public class I18NImage : I18NComponentBase 13 | { 14 | private Sprite _devSprite; 15 | 16 | /// 17 | /// I18N image name. 18 | /// 19 | public string ResName; 20 | 21 | private void Start() 22 | { 23 | _devSprite = gameObject.GetComponent().sprite; 24 | Create(); 25 | } 26 | 27 | public override void Refresh() 28 | { 29 | var image = gameObject.GetComponent(); 30 | image.sprite = Rosetta.IsDefault() ? _devSprite : Rosetta.GetSprite(ResName, I18NSpace); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /DocfxConf/custom_template/partials/affix.tmpl.partial: -------------------------------------------------------------------------------- 1 | {{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}} 2 | 3 | 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Shitake 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Component/I18NSpriteRenderer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Rosetta.Runtime.Component 4 | { 5 | /// 6 | /// Marking the current SpriteRenderer component requires I18N. 7 | /// 8 | [AddComponentMenu("Rosetta/I18NSpriteRenderer")] 9 | [RequireComponent(typeof(SpriteRenderer))] 10 | [HelpURL("https://molingyu.github.io/RosettaDocs/guides/makeI18NRes/component/I18NSpriteRenderer.html")] 11 | public class I18NSpriteRenderer : I18NComponentBase 12 | { 13 | private Sprite _devSprite; 14 | /// 15 | /// I18N image name. 16 | /// 17 | public string ResName; 18 | 19 | private void Start() 20 | { 21 | _devSprite = gameObject.GetComponent().sprite; 22 | Create(); 23 | } 24 | 25 | public override void Refresh() 26 | { 27 | var image = gameObject.GetComponent(); 28 | image.sprite = Rosetta.IsDefault() ? _devSprite : Rosetta.GetSprite(ResName, I18NSpace); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /ProjectSettings/PackageManagerSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 61 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | m_EnablePreReleasePackages: 0 16 | m_AdvancedSettingsExpanded: 1 17 | m_ScopedRegistriesSettingsExpanded: 1 18 | m_SeeAllPackageVersions: 0 19 | m_DismissPreviewPackagesInUse: 0 20 | oneTimeWarningShown: 0 21 | m_Registries: 22 | - m_Id: main 23 | m_Name: 24 | m_Url: https://packages.unity.cn 25 | m_Scopes: [] 26 | m_IsDefault: 1 27 | m_Capabilities: 7 28 | m_ConfigSource: 0 29 | m_UserSelectedRegistryName: 30 | m_UserAddingNewScopedRegistry: 0 31 | m_RegistryInfoDraft: 32 | m_Modified: 0 33 | m_ErrorMessage: 34 | m_UserModificationsInstanceId: -842 35 | m_OriginalInstanceId: -844 36 | m_LoadAssets: 0 37 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Component/I18NAudio.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Rosetta.Runtime.Component 4 | { 5 | /// 6 | /// Marking the current Audio component requires I18N. 7 | /// 8 | [AddComponentMenu("Rosetta/I18NAudio")] 9 | [RequireComponent(typeof(AudioSource))] 10 | [HelpURL("https://molingyu.github.io/RosettaDocs/guides/makeI18NRes/component/I18NAudio.html")] 11 | public class I18NAudio : I18NComponentBase 12 | { 13 | private AudioClip _devAudio; 14 | /// 15 | /// 16 | /// 17 | public string ResName; 18 | 19 | private void Start() 20 | { 21 | _devAudio = gameObject.GetComponent().clip; 22 | Create(); 23 | } 24 | 25 | public override void Refresh() 26 | { 27 | var audioSource = gameObject.GetComponent(); 28 | var status = audioSource.isPlaying; 29 | audioSource.clip = Rosetta.IsDefault() ? _devAudio : Rosetta.GetAudio(ResName, I18NSpace); 30 | if (status) audioSource.Play(); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 7 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 1 23 | m_ClothInterCollisionSettingsToggle: 0 24 | m_ContactPairsMode: 0 25 | m_BroadphaseType: 0 26 | m_WorldBounds: 27 | m_Center: {x: 0, y: 0, z: 0} 28 | m_Extent: {x: 250, y: 250, z: 250} 29 | m_WorldSubdivisions: 8 30 | -------------------------------------------------------------------------------- /DocfxConf/guides/makeI18NRes/component/I18NTMPText.md: -------------------------------------------------------------------------------- 1 | # I18NTMPText 组件 2 | 3 | I18NTMPText 和 I18NText 类似,不同的是, I18NTMPText 是用来支持 [Text Mesh Pro](https://docs.unity3d.com/Packages/com.unity.textmeshpro@2.0/manual/index.html) 插件的 [Text Mesh Pro UGUI](http://digitalnativestudios.com/textmeshpro/docs/textmeshpro-component/) 组件。 4 | 5 | 在运行时,I18NTMPText 组件通过订阅 Rosetta 的 [LocaleChanged](https://molingyu.github.io/RosettaDocs/api/Rosetta.Runtime.Rosetta.html#events) 事件,从而在切换语言后自动读取并替换当前 `GameObject` 的 `Text Mesh Pro UGUI` 组件内 `Text` 字段为当前语言对应的 I18N 文本资源。根据设置不同,可能还会替换 6 | `font` 7 | 字段。 8 | 9 | ![I18NTMPText](../../res/i18nTMPText.png) 10 | 11 | ## 属性 12 | |Name|Description| 13 | |---|:---| 14 | |I18N Comment|多语言资源注释。该注释会随着当前的 I18N 音频资源的模板文件一同交给多语言工作者。| 15 | |I18N Space|该 I18N TMPText 资源所属的域,关于域的说明请参阅 [使用 Collector 和 Creator: 域](https://molingyu.github.io/RosettaDocs/guides/useCollectorAndCreator.html#space--%E5%9F%9F)| 16 | |Is Virtual Font|是否启用虚拟字体设定。当启用后,Rosetta 加载时会先去根据 `Virtual Font Name` 读取虚拟字体配置文件,然后获取对应语言的真实字体文件的名称后再加载并应用。| 17 | |Virtual Font Name*|虚拟字体配置文件的名称。| 18 | 19 | *注: 只有当 `IsVirtualFont` 为真时,该字段才有用。另外,由于 TMPFont 的特殊性,暂时 Rosetta 只支持通过 Resources 文件夹加载,而无法从外部运行时加载。如果你有特殊需求,可以通过自定义 20 | Loader 来支持他。* -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | [Ll]ibrary/ 2 | [Tt]emp/ 3 | [Oo]bj/ 4 | [Bb]uild/ 5 | [Bb]uilds/ 6 | [Ll]ogs/ 7 | 8 | # Uncomment this line if you wish to ignore the asset store tools plugin 9 | # [Aa]ssets/AssetStoreTools* 10 | 11 | # Visual Studio cache directory 12 | .vs/ 13 | 14 | # Gradle cache directory 15 | .gradle/ 16 | 17 | # Autogenerated VS/MD/Consulo solution and project files 18 | ExportedObj/ 19 | .consulo/ 20 | *.csproj 21 | *.unityproj 22 | *.sln 23 | *.suo 24 | *.tmp 25 | *.user 26 | *.userprefs 27 | *.pidb 28 | *.booproj 29 | *.svd 30 | *.pdb 31 | *.mdb 32 | *.opendb 33 | *.VC.db 34 | 35 | # Unity3D generated meta files 36 | *.pidb.meta 37 | *.pdb.meta 38 | *.mdb.meta 39 | 40 | # Unity3D generated file on crash reports 41 | sysinfo.txt 42 | 43 | # Builds 44 | *.apk 45 | *.unitypackage 46 | 47 | # Crashlytics generated file 48 | crashlytics-build.properties 49 | 50 | # Sirenix 51 | Assets/Plugins/Sirenix/ 52 | Assets/Plugins/Sirenix.meta 53 | 54 | # IDE 55 | .idea/ 56 | Assets/Plugins/Editor/JetBrains/ 57 | Assets/Plugins/Editor/JetBrains.meta 58 | Assets/Plugins/Editor.meta 59 | 60 | # CI 61 | tools/ 62 | 63 | # Docs 64 | Docs/ 65 | 66 | # UPM 67 | Assets/Plugins/Rosetta/package.json 68 | Assets/Plugins/Rosetta/package.json.meta 69 | Assets/Plugins/Rosetta/.gitignore 70 | 71 | # VSC 72 | .vscode/ -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Custom/Property/FolderPathDrawer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEditor; 4 | using Rosetta.Runtime; 5 | 6 | namespace Rosetta.Editor.Custom.Property 7 | { 8 | [CustomPropertyDrawer(typeof(FolderPathAttribute), true)] 9 | public class FolderPathDrawer : PropertyDrawer 10 | { 11 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 12 | { 13 | EditorGUI.PropertyField(new Rect(position.x, position.y, position.width - 100, position.height), 14 | property, label); 15 | if (GUI.Button(new Rect(position.x + position.width - 80, position.y, 80, position.height), "Select")) 16 | { 17 | var selection = EditorUtility.OpenFolderPanel("Select Folder", property.stringValue, "Assets"); 18 | int assetIdx = selection.IndexOf("Assets", StringComparison.Ordinal); 19 | if (selection.Trim().Length == 0) return; 20 | if (assetIdx == -1) 21 | EditorUtility.DisplayDialog("Warning", "You need to specify a folder within the Assets folder.", "OK"); 22 | else property.stringValue = selection.Substring(assetIdx); 23 | } 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /ProjectSettings/MemorySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!387306366 &1 4 | MemorySettings: 5 | m_ObjectHideFlags: 0 6 | m_EditorMemorySettings: 7 | m_MainAllocatorBlockSize: -1 8 | m_ThreadAllocatorBlockSize: -1 9 | m_MainGfxBlockSize: -1 10 | m_ThreadGfxBlockSize: -1 11 | m_CacheBlockSize: -1 12 | m_TypetreeBlockSize: -1 13 | m_ProfilerBlockSize: -1 14 | m_ProfilerEditorBlockSize: -1 15 | m_BucketAllocatorGranularity: -1 16 | m_BucketAllocatorBucketsCount: -1 17 | m_BucketAllocatorBlockSize: -1 18 | m_BucketAllocatorBlockCount: -1 19 | m_ProfilerBucketAllocatorGranularity: -1 20 | m_ProfilerBucketAllocatorBucketsCount: -1 21 | m_ProfilerBucketAllocatorBlockSize: -1 22 | m_ProfilerBucketAllocatorBlockCount: -1 23 | m_TempAllocatorSizeMain: -1 24 | m_JobTempAllocatorBlockSize: -1 25 | m_BackgroundJobTempAllocatorBlockSize: -1 26 | m_JobTempAllocatorReducedBlockSize: -1 27 | m_TempAllocatorSizeGIBakingWorker: -1 28 | m_TempAllocatorSizeNavMeshWorker: -1 29 | m_TempAllocatorSizeAudioWorker: -1 30 | m_TempAllocatorSizeCloudWorker: -1 31 | m_TempAllocatorSizeGfx: -1 32 | m_TempAllocatorSizeJobWorker: -1 33 | m_TempAllocatorSizeBackgroundWorker: -1 34 | m_TempAllocatorSizePreloadManager: -1 35 | m_PlatformMemorySettings: {} 36 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Collector/CollectorBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Rosetta.Editor.Creator; 5 | using Rosetta.Runtime; 6 | using Rosetta.Runtime.Loader; 7 | using UnityEngine; 8 | 9 | namespace Rosetta.Editor.Collector 10 | { 11 | public abstract class CollectorBase : ScriptableObject 12 | { 13 | private static List _i18NClass; 14 | 15 | [HideInInspector] 16 | public Dictionary> I18NAudios; 17 | 18 | [HideInInspector] 19 | public Dictionary> I18NImages; 20 | 21 | [HideInInspector] 22 | public Dictionary> I18NFonts; 23 | 24 | [HideInInspector] 25 | public Dictionary> I18NStrings; 26 | 27 | public static List I18NClass => _i18NClass ??= GetI18NClass(); 28 | 29 | public abstract void Collect(string space); 30 | 31 | private static List GetI18NClass() 32 | { 33 | return AppDomain.CurrentDomain.GetAssemblies().SelectMany(assem => 34 | assem.GetTypes().Where(type => 35 | type.CustomAttributes.Any(attr => 36 | attr.AttributeType == typeof(I18NClassAttribute))) 37 | ).ToList(); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /DocfxConf/custom_template/schemas/Dashboard.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Dashboard", 3 | "$schema": "https://dotnet.github.io/docfx/schemas/v1.0/schema.json#", 4 | "version": "1.0.0", 5 | "description": "Schema for dashboard", 6 | "id": "https://github.com/dotnet/docfx/schemas/Dashboard.schema.json", 7 | "type": "object", 8 | "properties": { 9 | "uid": { 10 | "type": "string", 11 | "contentType": "uid" 12 | }, 13 | "title": { 14 | "type": "string", 15 | "tags": [ 16 | "localizable" 17 | ] 18 | }, 19 | "description": { 20 | "type": "string", 21 | "contentType": "markdown", 22 | "tags": [ 23 | "localizable" 24 | ] 25 | }, 26 | "items": { 27 | "items": { 28 | "properties": { 29 | "name": { 30 | "type": "string" 31 | }, 32 | "description": { 33 | "type": "string", 34 | "contentType": "markdown", 35 | "tags": [ 36 | "localizable" 37 | ] 38 | } 39 | }, 40 | "type": "object" 41 | }, 42 | "type": "array" 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Component/I18NComponentBase.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Rosetta.Runtime.Component 4 | { 5 | public abstract class I18NComponentBase : MonoBehaviour 6 | { 7 | /// 8 | /// Comments to the translator will be used for the pot file "#." comment. 9 | /// 10 | [Multiline(3)] 11 | public string I18NComment = ""; 12 | 13 | /// 14 | /// 15 | /// 16 | public string I18NSpace = "ui"; 17 | 18 | /// 19 | /// I18N Component initialization method.Will add the current component's `RosettaOnLocaleChanged` method 20 | /// to Rosetta.LocaleChanged event. 21 | /// This subscription is removed when the component is destroyed. 22 | /// 23 | protected void Create() 24 | { 25 | Refresh(); 26 | Rosetta.LocaleChanged += RosettaOnLocaleChanged; 27 | } 28 | 29 | /// 30 | /// Call this method when the `LocaleChanged` event is triggered. 31 | /// 32 | public abstract void Refresh(); 33 | 34 | void OnDestroy() 35 | { 36 | Rosetta.LocaleChanged -= RosettaOnLocaleChanged; 37 | } 38 | 39 | private void RosettaOnLocaleChanged(LangFlag _) 40 | { 41 | Refresh(); 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Creator/CreatorBase.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | using System.Text; 4 | using Rosetta.Editor.Collector; 5 | using Rosetta.Runtime; 6 | using UnityEngine; 7 | 8 | namespace Rosetta.Editor.Creator 9 | { 10 | public struct I18NString 11 | { 12 | public List PathList; 13 | public string Comment; 14 | public string Value; 15 | } 16 | 17 | public struct I18NMedia 18 | { 19 | public List PathList; 20 | public string Comment; 21 | public T Value; 22 | } 23 | 24 | 25 | public abstract class CreatorBase : ScriptableObject 26 | { 27 | [HideInInspector] 28 | public List Collectors = new(); 29 | public string Name; 30 | [FolderPath] public string OutputPath; 31 | 32 | protected abstract void _create(); 33 | 34 | public void Create() 35 | { 36 | _create(); 37 | } 38 | protected void SaveFile(string path, string value) 39 | { 40 | File.WriteAllText(path, value, Encoding.UTF8); 41 | } 42 | 43 | protected void SaveFile(string path, byte[] value) 44 | { 45 | File.WriteAllBytes(path, value); 46 | } 47 | 48 | protected void DirectoryCreate(string path) 49 | { 50 | DirectoryInfo di = new DirectoryInfo(path); 51 | if (!di.Exists) di.Create(); 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Component/I18NText.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UI; 3 | 4 | namespace Rosetta.Runtime.Component 5 | { 6 | /// 7 | /// Marking the current Text component requires I18N. 8 | /// 9 | [AddComponentMenu("Rosetta/I18NText")] 10 | [RequireComponent(typeof(Text))] 11 | [HelpURL("https://molingyu.github.io/RosettaDocs/guides/makeI18NRes/component/I18NText.html")] 12 | public class I18NText : I18NComponentBase 13 | { 14 | private Font _devFont; 15 | private string _devString; 16 | /// 17 | /// When this is true, the corresponding i18n font is loaded via the `VirtualFontName` instead of the currently set font. 18 | /// 19 | [HideInInspector] public bool IsVirtualFont; 20 | 21 | /// 22 | /// I18n font name. 23 | /// 24 | [HideInInspector] public string VirtualFontName = ""; 25 | 26 | private void Start() 27 | { 28 | _devString = gameObject.GetComponent().text; 29 | _devFont = gameObject.GetComponent().font; 30 | Create(); 31 | } 32 | 33 | public override void Refresh() 34 | { 35 | var text = gameObject.GetComponent(); 36 | text.text = Rosetta.GetText(_devString, I18NSpace); 37 | if (IsVirtualFont) text.font = Rosetta.IsDefault() ? _devFont : Rosetta.GetFont(VirtualFontName); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /DocfxConf/docfx.json: -------------------------------------------------------------------------------- 1 | { 2 | "metadata": [ 3 | { 4 | "src": [ 5 | { 6 | "files": [ 7 | "Rosetta.Runtime.csproj", 8 | "Rosetta.Editor.csproj" 9 | ], 10 | "src": ".." 11 | } 12 | ], 13 | "dest": "api" 14 | } 15 | ], 16 | "build": { 17 | "content": [ 18 | { 19 | "files": [ 20 | "api/**.yml", 21 | "api/toc.yml" 22 | ] 23 | }, 24 | { 25 | "files": [ 26 | "guides/**/*.{md,yml}", 27 | "toc.yml", 28 | "*.md" 29 | ] 30 | } 31 | ], 32 | "resource": [ 33 | { 34 | "src": "..", 35 | "files": [ 36 | "Res/**" 37 | ] 38 | }, 39 | { 40 | "src": ".", 41 | "files": [ 42 | "guides/res/**" 43 | ] 44 | } 45 | ], 46 | "overwrite": [ 47 | { 48 | "files": [ 49 | "apidoc/**.md" 50 | ], 51 | "exclude": [ 52 | "obj/**", 53 | "_site/**" 54 | ] 55 | } 56 | ], 57 | "dest": "../Docs", 58 | "globalMetadata":{ 59 | "_appTitle": "Rosetta website", 60 | "_appFooter": "Copyright © Shitake.
Generated by DocFX
" 61 | }, 62 | "fileMetadataFiles": [], 63 | "postProcessors": [ "ExtractSearchIndex" ], 64 | "markdownEngineName": "markdig", 65 | "template": [ 66 | "default", 67 | "custom_template" 68 | ] 69 | } 70 | } -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Component/I18NTMPText.cs: -------------------------------------------------------------------------------- 1 | using TMPro; 2 | using UnityEngine; 3 | 4 | namespace Rosetta.Runtime.Component 5 | { 6 | /// 7 | /// Marking the current TMPText component requires I18N. 8 | /// 9 | [AddComponentMenu("Rosetta/I18NTMPText")] 10 | [RequireComponent(typeof(TMP_Text))] 11 | [HelpURL("https://molingyu.github.io/RosettaDocs/guides/makeI18NRes/component/I18NTMPText.html")] 12 | public class I18NtmpText : I18NComponentBase 13 | { 14 | private TMP_FontAsset _devFont; 15 | private string _devString; 16 | /// 17 | /// If true, the corresponding i18n font is loaded via the `VirtualFontName` instead of the currently set font. 18 | /// 19 | [HideInInspector] public bool IsVirtualFont; 20 | /// 21 | /// I18n font name. 22 | /// 23 | [HideInInspector] public string VirtualFontName = ""; 24 | 25 | private void Start() 26 | { 27 | _devString = gameObject.GetComponent().text; 28 | _devFont = gameObject.GetComponent().font; 29 | Create(); 30 | } 31 | 32 | public override void Refresh() 33 | { 34 | var text = gameObject.GetComponent(); 35 | text.text = Rosetta.GetText(_devString, I18NSpace); 36 | if (IsVirtualFont) text.font = Rosetta.IsDefault() ? _devFont : Rosetta.GetTMP_Font(VirtualFontName); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rosetta 2 | 3 | I18N in Unity3D made easy and automation. Full support for GNU [GetText](https://www.gnu.org/software/gettext/) i18n workflow and Unity media files. 4 | 5 | You can reach the me right here by opening a [new issue](https://github.com/molingyu/Rosetta/issues/new), or send email at [@shitake233](https://twitter.com/shitake233). 6 | 7 | *Warrning: Rosetta depends on [Odin Inspector](http://sirenix.net/odininspector) plugin. Make sure you have a license for [Odin Inspector](http://sirenix.net/odininspector) before using Rosetta.* 8 | 9 | ![Rosetta](./Res/Rosetta.png) 10 | 11 | ## Feature 12 | 13 | + [GetText](https://www.gnu.org/software/gettext/) like text I18N system(creation and loading of pot/po file). 14 | + Unity media file support(Font/Sprite/AudioClip). 15 | + New languages can be added externally at runtime (mod system) 16 | + UGUI and TextMesh Pro support. 17 | 18 | ## Installation and usage 19 | 20 | + Download unitypackage from [Releases](https://github.com/molingyu/Rosetta/releases) and import it. 21 | * Use [UPM](https://github.com/molingyu/shitake.rosetta) 22 | 23 | [API Document & Guides](https://molingyu.github.io/RosettaDocs/) 24 | 25 | ## Demo 26 | 27 | A simple game [demo](https://www.dropbox.com/s/npkllqne2l8xea0/RosettaExample.rar?dl=0) (Dropbox). 28 | 29 | ### Mirrors 30 | + [China](https://pan.baidu.com/s/16dXxgmDyA4UU9Cd0a-CvdA) (BaiduYun 提取码: dwca ) 31 | 32 | ## Roadmap 33 | + Mo file support. 34 | + Add TextMesh Pro font Loader. 35 | + Get text from source code. 36 | 37 | ## License 38 | 39 | [MIT](./LICENSE) 40 | 41 | Copyright 2019 Shitake. -------------------------------------------------------------------------------- /DocfxConf/guides/gettingStarted.md: -------------------------------------------------------------------------------- 1 | # 起步 2 | 3 | ## 1. 什么是 Rosetta 4 | ![Rosetta](../../Res/Rosetta.png) 5 | 6 | 7 | ## 2. 获取 8 | 你可以从 [GitHub Release](https://github.com/molingyu/Rosetta/releases) 页面获取打包好的 *unitypackage* 文件。 9 | 10 | 另外,你也可以通过 git repo 以 [UPM](https://forum.unity.com/threads/git-support-on-package-manager.573673/) 的方式将 [Rosetta](https://github.com/molingyu/shitake.rosetta) 11 | 引入你的项目。 12 | 13 | ## 3. 在 Unity 中使用 Rosetta 14 | 15 | > [!IMPORTANT] 16 | > Rosetta 使用 [Odin Inspector](https://odininspector.com/) 来简化编辑器部分的开发。使用 Rosetta 前请确保已安装 Odin Inspector 插件。 17 | 18 | ### 3.1 标记 I18N 资源 19 | Rosetta 的一大特点就在于通过一些 Unity 和 C# 的特性,从而尽量让整个 I18N 工作自动化。 20 | 21 | I18N 资源可能会以各种方式存在于工程中。在 Unity 下大体存在以下几类情况: 22 | 23 | 1. 以 Scene 内 的 GameObject 上挂载的 Component 的字段存在。例如 Text 组件的 Text, Image 组件的 Sprite(Source Image)等。 24 | 2. 情况同第一条,不同的是这些 GameObject 存在于 Prefab 而不是 Scene。 25 | 3. 在一些自定义的数据结构的相关字段上。这些数据可能来自一个具体 ScriptableObject 对象,或者对应的 xml、json 或 csv 的配置文件上。 26 | 27 | 以上三种情况对应着三种游戏内数据来源:UI、关卡/地图数据、数据库数据。在 Rosetta 中,针对每种情况都有预先定义好的标记来标记这些需要收集的 I18N 数据。 28 | 29 | ### 3.2 创建 I18NCreator 并生成翻译文件模板 30 | 对于 Rosetta 来说,I18N资源通过对应的方式标记后,就可以通过 I18N Collector 来收集,并通过 I18N Creator 生成对应的 I18N 31 | 模板文件。这些模板文件会提交给翻译工作人员完成翻译。最后在运行时,通过对应的加载器完成加载。 32 | 33 | ![Pot Creator](./res/creator.png) 34 | 35 | ### 3.3 和翻译人员对接 36 | 37 | Rosetta 对于不同的 I18N 资源会生成不同的翻译模板文件。对于文本资源,会生成标准的 [GNU Gettext](https://www.gnu.org/software/gettext/manual/gettext.html) 翻译文件模板文件(`.pot`)。 38 | 39 | 翻译人员可以使用 GNU Gettext 的相关工具链。通过诸如 [Poedit](https://poedit.net/) 这样的软件可以十分轻松的完成翻译工作。 40 | 41 | 对于多人合作翻译,一些翻译内容管理系统也是很好的选择([Weblate](https://weblate.org/))。 42 | 43 | 除此之外,Rosetta 也会处理音频、图像和字体资源的 I18N 问题。对于这些内容,除翻译工作人员外,也会用到其他诸如美术、音频等工作者的参与。 -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /DocfxConf/guides/useCollectorAndCreator.md: -------------------------------------------------------------------------------- 1 | # 使用 Collector 和 Creator 2 | 3 | 当你通过 I18N 标记完成对 I18N 资源的标记后,你可以通过创建 Collector 和 Creator 生成你的 翻译模板文件了。Collector 会自动扫描指定的 Unity 资源文件,从中收集需要进行 I18N 4 | 的资源。之后这些数据会传入给对应的 Creator 从而生成特定格式的翻译模板文件。 5 | 6 | ## Collector | 收集器 7 | Collector 是在 Creator 内部使用的类。一个 Creator 可以拥有多个 Collector。以使得他们可以从不同的地方来收集相同类型的I18N 资源。 8 | 9 | * **SceneCollector & PrefabCollector** 10 | 11 | 通过扫描 `GameObject` 上是否挂载了 I18NComponent 从 `Scene`/`Prefab` 上搜集 I18N 数据。 12 | 13 | * **ScriptableObjectCollector** 14 | 15 | 通过反射获取类型信息,判断其是否存在 I18NAttribute 而收集 `ScriptableObject` 上的 I18N 数据。 16 | 17 | ![ScriptableObjectCollector](./res/scriptableObjectCollector.png) 18 | 19 | `ScriptableObjectCollector` 会扫描指定的文件夹,然后自动载入所有的 `ScriptableObject` 资源。 20 | 21 | ## Creator | 创建器 22 | 23 | * **PotCreator** 24 | 25 | ![PotCreator](./res/potCreator.png) 26 | 27 | `PotCreator` 负责创建 Pot 格式的翻译模板文件。关于 Pot 的更多内容可以访问[这里](https://www.gnu.org/software/gettext/manual/gettext.html#PO-Files)了解。 28 | 29 | ### 属性 30 | |Name|Description| 31 | |---|:---| 32 | |Name|生成的pot文件的名字,同时该值也意味着该资源的**域**(space)。| 33 | |Output Path|模板文件的输出地址。| 34 | |Info|等同于 Po 文件的[文件头部分](https://www.gnu.org/software/gettext/manual/gettext.html#Header-Entry)| 35 | 36 | * **MediaCreator** 37 | 38 | ![MediaCreator](./res/mediaCreator.png) 39 | 40 | ### 属性 41 | |Name|Description| 42 | |---|:---| 43 | |Name|生成的pot文件的名字,同时该值也意味着该资源的**域**(space)。| 44 | |Output Path|模板文件的输出地址。| 45 | 46 | ## Space | 域 47 | 48 | 在我们使用 Creator 的过程中,会发现每个 Creator 都需要指定一个 `space`。Rosetta 创造这个概念的主要目的是为了方便 I18N 资源的分段加载。对于游戏来说,I18N 49 | 资源量大,而且往往不仅仅只是文本。一次性载入所有的 I18N 资源会占用太多的内存资源。这时候就需要通过 `space` 50 | 来把资源做分段处理。然后我们只需要在用到的时候加载,然后在不需要的时候释放就可以了(关于缓存和释放的问题,可以参考[这个]())。 51 | 52 | Rosetta 默认所有的 UI 部分的 I18N 资源处于一个名为 `ui` 的域中,这个域默认全局常驻。除此之外,你可以为每个关卡创建一个域,这样就可以在加载关卡数据的时候同时加载其对应的 I18N 53 | 资源。而当退出关卡的时候卸载掉其对应的域从而释放这些不需要的 I18N 资源。 -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Loader/FontLoader.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using TMPro; 3 | using UnityEngine; 4 | 5 | namespace Rosetta.Runtime.Loader 6 | { 7 | /// 8 | /// Load font/TMP_Font file in runtime and return a `Font`/`TMP_FontAsset` object 9 | /// 10 | public struct FontInfo 11 | { 12 | /// 13 | /// The font file name. 14 | /// 15 | public string FontName; 16 | /// 17 | /// The font size. Used only when reading font from the OS. 18 | /// 19 | public int Size; 20 | /// 21 | /// Whether it is a font in TMP format. 22 | /// 23 | public bool IsTmpFont; 24 | /// 25 | /// Whether the font file is included in Resources. When this is no, the font will be loaded from the operating system. 26 | /// 27 | public bool IsDefaultInclude; 28 | } 29 | 30 | public class FontLoader : LoaderBase 31 | { 32 | public override T Load(string _, string virtualFontName, LangFlag? flag = null) 33 | { 34 | LoadBase(Path.Combine("res", "font", virtualFontName), flag ?? Rosetta.Locale); 35 | ExtensionName = "json"; 36 | var info = JsonUtility.FromJson(LoadFile()); 37 | if (info.IsDefaultInclude) 38 | { 39 | if (info.IsTmpFont) 40 | { 41 | return (T) (object) Resources.Load(info.FontName); 42 | } 43 | return (T) (object) Resources.Load(info.FontName); 44 | } 45 | var font = Font.CreateDynamicFontFromOSFont(info.FontName, info.Size); 46 | return (T) (object) font; 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Loader/MultiMediaLoader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using UnityEngine; 5 | 6 | namespace Rosetta.Runtime.Loader 7 | { 8 | 9 | [Serializable] 10 | public struct MediaInfo 11 | { 12 | public List Audios; 13 | public List Images; 14 | } 15 | 16 | /// 17 | /// MultiMediaLoader will load multiple sprites and audios according to the `mediaInfo` file. 18 | /// 19 | public class MultiMediaLoader : LoaderBase 20 | { 21 | public override T Load(string space, string filename, LangFlag? flag = null) 22 | { 23 | throw new Exception("MultiMediaLoader this method is invalid."); 24 | } 25 | 26 | public void Load(string space, LangFlag locale, 27 | ref Dictionary> spriteCache, 28 | ref Dictionary> audioCache) 29 | { 30 | LoadBase(Path.Combine(space, "mediaInfo"), locale); 31 | ExtensionName = "json"; 32 | var info = JsonUtility.FromJson(LoadFile());; 33 | audioCache[space] = new Dictionary(); 34 | spriteCache[space] = new Dictionary(); 35 | foreach (var infoAudio in info.Audios) 36 | { 37 | audioCache[space].Add(infoAudio, Rosetta.Loaders[I18NFileType.Wav] 38 | .Load(space, infoAudio, locale)); 39 | } 40 | foreach (var infoImage in info.Images) 41 | { 42 | spriteCache[space].Add(infoImage, Rosetta.Loaders[I18NFileType.Png] 43 | .Load(space, infoImage, locale)); 44 | } 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Loader/PoLoader.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace Rosetta.Runtime.Loader 5 | { 6 | /// 7 | /// Po file Loader.See more information about .po files here(https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html). 8 | /// 9 | public class PoLoader : LoaderBase 10 | { 11 | public override T Load(string _, string filename, LangFlag? flag = null) 12 | { 13 | ExtensionName = "po"; 14 | LoadBase(filename, flag ?? Rosetta.Locale); 15 | return (T)(object)Parse(LoadFile()); 16 | } 17 | 18 | /// 19 | /// Parse the Po file string into a C# data `Dictionary` and return it. 20 | /// 21 | /// The Po file string 22 | /// 23 | public Dictionary Parse(string str) 24 | { 25 | var catalog = new Dictionary(); 26 | string key = null; 27 | string val = null; 28 | str.Split('\n').ToList().ForEach(line => 29 | { 30 | if (line.StartsWith("msgid \"")) 31 | { 32 | key = line.Substring(7, line.Length - 8); 33 | } 34 | else if (line.StartsWith("msgstr \"")) 35 | { 36 | val = line.Substring(8, line.Length - 9); 37 | } 38 | else 39 | { 40 | if (key != null && val != null) 41 | { 42 | catalog.Add(key, val); 43 | key = val = null; 44 | } 45 | } 46 | }); 47 | return catalog; 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.collab-proxy": "2.0.5", 4 | "com.unity.feature.2d": "2.0.0", 5 | "com.unity.ide.rider": "3.0.24", 6 | "com.unity.ide.visualstudio": "2.0.18", 7 | "com.unity.test-framework": "1.1.33", 8 | "com.unity.textmeshpro": "3.0.6", 9 | "com.unity.timeline": "1.7.5", 10 | "com.unity.ugui": "1.0.0", 11 | "com.unity.visualscripting": "1.8.0", 12 | "com.unity.modules.ai": "1.0.0", 13 | "com.unity.modules.androidjni": "1.0.0", 14 | "com.unity.modules.animation": "1.0.0", 15 | "com.unity.modules.assetbundle": "1.0.0", 16 | "com.unity.modules.audio": "1.0.0", 17 | "com.unity.modules.cloth": "1.0.0", 18 | "com.unity.modules.director": "1.0.0", 19 | "com.unity.modules.imageconversion": "1.0.0", 20 | "com.unity.modules.imgui": "1.0.0", 21 | "com.unity.modules.jsonserialize": "1.0.0", 22 | "com.unity.modules.particlesystem": "1.0.0", 23 | "com.unity.modules.physics": "1.0.0", 24 | "com.unity.modules.physics2d": "1.0.0", 25 | "com.unity.modules.screencapture": "1.0.0", 26 | "com.unity.modules.terrain": "1.0.0", 27 | "com.unity.modules.terrainphysics": "1.0.0", 28 | "com.unity.modules.tilemap": "1.0.0", 29 | "com.unity.modules.ui": "1.0.0", 30 | "com.unity.modules.uielements": "1.0.0", 31 | "com.unity.modules.umbra": "1.0.0", 32 | "com.unity.modules.unityanalytics": "1.0.0", 33 | "com.unity.modules.unitywebrequest": "1.0.0", 34 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 35 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 36 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 37 | "com.unity.modules.unitywebrequestwww": "1.0.0", 38 | "com.unity.modules.vehicles": "1.0.0", 39 | "com.unity.modules.video": "1.0.0", 40 | "com.unity.modules.vr": "1.0.0", 41 | "com.unity.modules.wind": "1.0.0", 42 | "com.unity.modules.xr": "1.0.0" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /DocfxConf/guides/loadAndUseOnRuntime.md: -------------------------------------------------------------------------------- 1 | # 运行时加载和使用 2 | 3 | Rosetta 的全局入口是位于 `Rosetta.Runtime` 命名空间内的名为 `Rosetta` 的静态类(为便于区分,在下文里约定 Rosetta 指整个框架, `Rosetta` 该静态类)。`Rosetta` 4 | 提供了初始化函数。不过这里有两条路径可以完成这个任务。 5 | 6 | 7 | ## 运行时配置 8 | 9 | ### 在代码中配置 10 | 11 | 一个方式是在代码中指定 Rosetta 的各种运行时设置。这时候你需要使用 `Rosetta.Init` 并传入一个[参数列表](https://molingyu.github.io/RosettaDocs/api/Rosetta.Runtime.Rosetta.html#Rosetta_Runtime_Rosetta_Init_Rosetta_Runtime_LangFlag_Rosetta_Runtime_LangFlag_System_Collections_Generic_List_System_String__Rosetta_Runtime_I18NFileType_)。 12 | 13 | ### RosettaRuntimeSetting 14 | 15 | 通过 RosettaRuntimeSetting 启动。 16 | 17 | RosettaRuntimeSetting 是一个 ScriptableObject。你可以通过 Project 窗口里的右键菜单来创建。 18 | 19 | `Rosetta` 默认提供一个方法来自动加载它,前提是这个文件位于 Resources 20 | 文件夹内,并且保证文件名为 `RosettaRuntimeSetting`。当然你也可以通过自己的方式读取它,然后在把他的参数读取并传递给 `Rosetta.init`,就像第一个启动方式一样。 21 | 22 | ![RosettaRuntimeSetting](./res/rosettaRuntimeSetting.png) 23 | 24 | #### 属性 25 | |Name|Description| 26 | |---|:---| 27 | |Default I18N Spaces|默认全局持有**域**,在 Rosetta 启动后会被直接载入,并全局持有,不会主动释放。| 28 | |Dev Locale|默认开发时的语言。| 29 | |Text File Type|暂时只支持 Po,之后会支持 mo 格式的载入。| 30 | 31 | 32 | ## 初始化 33 | 34 | Rosetta 的初始化函数为 `Rosetta.Init`,无论是否使用 RosettaRuntimeSetting,都需要在初始化时传入一个参数来指定以那个语言来启动。之后 Rosetta 会根据这个值来加载对应语言的默认全局持有**域**。 35 | 36 | 因此,我们建议在你的游戏完成其他资源加载,而又未开始游戏进程前,完成 Rosetta 的初始化工作。 37 | 38 | 39 | ## 获取 I18N 资源 40 | 41 | 对于被 I18N 组件标记的资源来说,会根据当前所选语言自动完成切换。但是对于其他的来说(比如 ScriptableObject),需要手动获取对应的 I18N 资源并刷新。 42 | 43 | `Rosetta` 提供了一系列方法来获取对应的多语言化后的资源。具体请参考 `Rosetta` 的 API 文档。 44 | 45 | Rosetta 会根据 `Rosetta.LoadPath` 里的路径依次尝试加载(默认值为游戏顶层文件夹下的 I18N 文件夹)。你可以通过给这个列表添加新的值从而支持从其他地方加载多语言文件(如多语言 Mod)。 46 | 47 | ## 运行时域的处理 48 | 49 | `Rosetta.LoadI18NResSpace(String)` 和 `Rosetta.UnloadI18NResSpace(String)` 分别用来加载和卸载对应的**域**的 I18N 资源。 50 | 51 | ## 监听失败 52 | 53 | 当资源加载发生错误或者需求的资源不存在时,会触发 `I18NFileMissing` 事件。而当对应的 Po 文件里不存在要求的 I18NString 时 会触发 `I18NStringMissing` 54 | 事件。你可以订阅这两个事件从而监听加载失败。 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Runtime/Loader/PngLoader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using UnityEngine; 4 | 5 | namespace Rosetta.Runtime.Loader 6 | { 7 | /// 8 | /// Record picture pivot and size. 9 | /// 10 | [Serializable] 11 | public struct ImageInfo 12 | { 13 | /// 14 | /// The x value of image pivot.it equal to the x value of sprite pivot. 15 | /// 16 | public float PivotX; 17 | /// 18 | /// The y value of image pivot.it equal to the y value of sprite pivot. 19 | /// 20 | public float PivotY; 21 | /// 22 | /// The `width` of image. 23 | /// 24 | public int Width; 25 | /// 26 | /// The `height` of image. 27 | /// 28 | public int Height; 29 | /// 30 | /// The I18N file comment. 31 | /// 32 | public string Comment; 33 | } 34 | 35 | /// 36 | /// Load `.png` file in runtime and return a `Sprite` object 37 | /// 38 | public class PngLoader : LoaderBase 39 | { 40 | public override T Load(string space,string filename, LangFlag? flag = null) 41 | { 42 | LoadBase(Path.Combine("res", "img", space, filename), flag ?? Rosetta.Locale); 43 | ExtensionName = "json"; 44 | var info = JsonUtility.FromJson(LoadFile()); 45 | ExtensionName = "png"; 46 | var tex = new Texture2D(info.Width, info.Height); 47 | tex.LoadImage(LoadFile()); 48 | var sprite = Sprite.Create(tex, new Rect(new Vector2(0, 0), new Vector2(info.Width, info.Height)), 49 | new Vector2(info.PivotX, info.PivotY)); 50 | sprite.name = $"{filename}_{(flag ?? Rosetta.Locale).ToString().ToLower()}"; 51 | return (T) (object) sprite; 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /Assets/Plugins/Rosetta/Editor/Custom/RosettaRuntimeSettingEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using UnityEditor; 3 | using static UnityEditor.EditorGUILayout; 4 | using System.Collections.Generic; 5 | 6 | namespace Rosetta.Runtime.Custom 7 | { 8 | [CustomEditor(typeof(RosettaRuntimeSetting))] 9 | public class RosettaRuntimeSettingEditor : UnityEditor.Editor 10 | { 11 | private static Dictionary _textFileType = new Dictionary() 12 | { 13 | {"Po", I18NFileType.Po} 14 | //{"Mo", I18NFileType.Mo}, 15 | //{"CSV", I18NFileType.Csv}, 16 | //{"JSON", I18NFileType.Json}, 17 | }; 18 | 19 | public override void OnInspectorGUI() 20 | { 21 | var serSpaces = serializedObject.FindProperty("DefaultI18NSpaces"); 22 | PropertyField(serSpaces, true); 23 | 24 | // DevLocale 25 | var langNames = Rosetta.LangNames; 26 | var displays = langNames.Select(i => $"{i.Value} ({i.Key})").ToArray(); 27 | var langValues = langNames.Select(i => i.Key).ToArray(); 28 | var serDevLocale = serializedObject.FindProperty("DevLocale"); 29 | 30 | var prevVal = serDevLocale.enumValueIndex; 31 | var newVal = Popup("DevLocale", serDevLocale.enumValueIndex, displays); 32 | if (prevVal != newVal && EditorUtility.DisplayDialog("Switch Dev Locale language?", 33 | "Are you sure you want to switch Dev Locale language?", "Switch", "Do Not Switch")) 34 | serDevLocale.enumValueIndex = (int)langValues[newVal]; 35 | 36 | // TextFileType 37 | displays = _textFileType.Select(i => i.Key).ToArray(); 38 | var fileValues = _textFileType.Select(i => i.Value).ToArray(); 39 | var serTextFileType = serializedObject.FindProperty("TextFileType"); 40 | serTextFileType.enumValueIndex = (int)fileValues[Popup("TextFileType", serTextFileType.enumValueIndex, displays)]; 41 | serializedObject.ApplyModifiedProperties(); 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /DocfxConf/guides/translationFileTemplate.md: -------------------------------------------------------------------------------- 1 | # 翻译文件模板 2 | 3 | Rosetta 的翻译模板文件是以 Creator 为单位进行生成的。不同的 Creator 生成不同结构的文件。 4 | 5 | 需要注意的是,目前对于图片和音频只支持有限的格式(png/wav)。你可以通过实现其他个格式的 Loader 来支持你需要的格式,这样做完 I18N 处理的文件就可以保存为你需要的格式了。 6 | 7 | ## PotCreator 8 | `PotCreator` 负责生成 GNU GetText 的标准翻译模板文件 `.pot` 文件。 9 | 10 | ![pot](./res/pot.png) 11 | 12 | 需要注意的是,在 gettext 里 pot/po 文件的文件名用来区分对应的是哪一个语言。而在 Rosetta 中则完全不同。因为 Rosetta 需要分段加载的缘故。不同语言使用不同的文件夹来区分。而 pot/po 13 | 文件的文件名则用来区分他是哪一个**域**(space)。 14 | 15 | # MediaCreator 16 | `MediaCreator` 负责生成音频/图片/字体的 I18N 翻译模板文件。 17 | 18 | ``` 19 | I18NTempate 20 | ├─res 21 | │ ├─audio 22 | │ │ └─ 23 | │ │ └─ 24 | │ ├─font 25 | │ │ └─ 26 | │ │ └─ 27 | │ └─img 28 | │ └─ 29 | │ └─ 30 | └─ 31 | └─mediaInfo.json 32 | ``` 33 | Rosetta 的翻译文件依据 `space` 来划分。所有的多媒体资源则统一放在 `res` 文件夹下对应类型的子文件夹内。同时 `MediaCreator` 会创建一个名为 `mediaInfo.json` 的文件,用来记录对应 34 | `space` 下包含那些多媒体资源。 35 | 36 | 对于多媒体资源文件的 I18N 工作,下边会根据文件类型来逐一说明。 37 | 38 | ### img 39 | 对于图片资源,会在 `I18NTemplate/res/img//` 下生成一个格式为 `png` I18N 图片的拷贝以及同名的 json 文件。在进行 I18N 工作时,只需要依照图片拷贝提供相同格式的相同大小的 40 | I18N 41 | 后的图片文件。 json 文件不需要做任何变动。 42 | 43 | _注:如果一个图片文件原本为一个 multiple sprite 上的一个 sprite。生成拷贝时只会复制其对应的部分,而不会复制整个 multiple sprite 所对应的 texture。顺便,对应的 json 44 | 文件里记录了相关的位置和大小信息。_ 45 | 46 | ### Audio 47 | 对于音频资源,会在 `I18NTemplate/res/img//` 生成一个对应的音频文件拷贝。需要注意的是,虽然拷贝的格式会和原文件保持一致。但是做完 I18N 处理后需要提供 `wav` 48 | 格式的文件,这是因为目前 Rosetta 只支持对 `wav` 的加载。 49 | 50 | ### font 51 | 对于字体资源,会在 `I18NTemplate/res/font//` 生成一个名为 `.json` 的文件。 52 | 53 | ![font](./res/font.png) 54 | 55 | 该文件记录了你的 I18N 字体资源的导入情况。你需要根据需要来重新天写该文件。 56 | 57 | `FontName` 项记录了实际字体资源的名字。Rosetta 会根据这个名字在运行时查找并载入。 58 | 59 | `Size` 决定了字体在载入时设定的大小。该值仅在字体是从操作系统读取时有效。其效果和 [Font ImportSettings 里的 Font Size](https://docs.unity3d.com/Manual/class-Font.html) 项类似。 60 | 61 | `IsTmpFont`该项指明该资源是否为一个 TMPFont 资源。需要注意的时,TMPFont 无法从外部加载。 62 | 63 | `IsDefaultInclude` 该项决定了字体资源具体从哪里加载。当为 `true` 时,这意味着你的游戏打包时就已经将字体文件打包在内了(在 unity Resources 64 | 文件夹内),否则将从操作系统字体文件夹内直接读入([参考](https://docs.unity3d.com/ScriptReference/Font.CreateDynamicFontFromOSFont.html))。 -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_JobOptions: 23 | serializedVersion: 2 24 | useMultithreading: 0 25 | useConsistencySorting: 0 26 | m_InterpolationPosesPerJob: 100 27 | m_NewContactsPerJob: 30 28 | m_CollideContactsPerJob: 100 29 | m_ClearFlagsPerJob: 200 30 | m_ClearBodyForcesPerJob: 200 31 | m_SyncDiscreteFixturesPerJob: 50 32 | m_SyncContinuousFixturesPerJob: 50 33 | m_FindNearestContactsPerJob: 100 34 | m_UpdateTriggerContactsPerJob: 100 35 | m_IslandSolverCostThreshold: 100 36 | m_IslandSolverBodyCostScale: 1 37 | m_IslandSolverContactCostScale: 10 38 | m_IslandSolverJointCostScale: 10 39 | m_IslandSolverBodiesPerJob: 50 40 | m_IslandSolverContactsPerJob: 50 41 | m_AutoSimulation: 1 42 | m_QueriesHitTriggers: 1 43 | m_QueriesStartInColliders: 1 44 | m_CallbacksOnDisable: 1 45 | m_AutoSyncTransforms: 1 46 | m_AlwaysShowColliders: 0 47 | m_ShowColliderSleep: 1 48 | m_ShowColliderContacts: 0 49 | m_ShowColliderAABB: 0 50 | m_ContactArrowScale: 0.2 51 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 52 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 53 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 54 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 55 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 56 | -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 12 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 10783, guid: 0000000000000000f000000000000000, type: 0} 35 | m_PreloadedShaders: [] 36 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 37 | type: 0} 38 | m_CustomRenderPipeline: {fileID: 0} 39 | m_TransparencySortMode: 0 40 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 41 | m_DefaultRenderingPath: 1 42 | m_DefaultMobileRenderingPath: 1 43 | m_TierSettings: [] 44 | m_LightmapStripping: 0 45 | m_FogStripping: 0 46 | m_InstancingStripping: 0 47 | m_LightmapKeepPlain: 1 48 | m_LightmapKeepDirCombined: 1 49 | m_LightmapKeepDynamicPlain: 1 50 | m_LightmapKeepDynamicDirCombined: 1 51 | m_LightmapKeepShadowMask: 1 52 | m_LightmapKeepSubtractive: 1 53 | m_FogKeepLinear: 1 54 | m_FogKeepExp: 1 55 | m_FogKeepExp2: 1 56 | m_AlbedoSwatchInfos: [] 57 | m_LightsUseLinearIntensity: 0 58 | m_LightsUseColorTemperature: 0 59 | -------------------------------------------------------------------------------- /DocfxConf/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Welcome to Rosetta website! 3 | documentType: index 4 | --- 5 | 13 | 14 |
15 |
16 |
17 | Rosetta 18 |
19 | 22 |
23 | I18N in Unity3D made easy and automation. Full support for GNU GetText i18n workflow. 24 |
25 | 29 |
30 |
31 | 32 |
33 |
34 |
35 |
36 |
37 |

GNU GetText workflow

38 |

creation and loading of pot/po file

39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |

Unity media file support

50 |

Support Unity media file,e.g. Sprite/Font/AudioClip/TMP_Font

51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |

Load new language at runtime

62 |

Use different loaders to support loading of different types of i18n files at runtime 63 | (default support png/font/wav/po files)

64 |
65 |
66 |
67 |
68 |
-------------------------------------------------------------------------------- /DocfxConf/custom_template/layout/_master.tmpl: -------------------------------------------------------------------------------- 1 | {{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}} 2 | {{!include(/^styles/.*/)}} 3 | {{!include(/^fonts/.*/)}} 4 | {{!include(favicon.ico)}} 5 | {{!include(logo.svg)}} 6 | {{!include(search-stopwords.json)}} 7 | 8 | 9 | 10 | {{>partials/head}} 11 | 12 |
13 |
14 | {{^_disableNavbar}} 15 | {{>partials/navbar}} 16 | {{/_disableNavbar}} 17 | {{^_disableBreadcrumb}} 18 | {{>partials/breadcrumb}} 19 | {{/_disableBreadcrumb}} 20 |
21 | {{#_enableSearch}} 22 |
23 | {{>partials/searchResults}} 24 |
25 | {{/_enableSearch}} 26 |